wordpress代码

首页,新闻下的内容

  <!-- Start Blog Area -->
        <section class="blog-area pb-70">
            <div class="container">
                <div class="section-title">
                    <h2>Latest News</h2>
                </div>

                <div class="row">
<?php 
    $args         = array(
      'post_type' => 'post',
            'posts_per_page'      => 3,
            //'cat'                 => $cats,
            'orderby'             => 'date',
            'ignore_sticky_posts' => true,
            // 'post__not_in'        => array( $post->ID ),
        );
     

        $loop = new WP_Query( $args );
        

 while ( $loop->have_posts() ) :
     $loop->the_post();
 
  $title = $post->post_title;
  $excerpt = $post->post_excerpt;

  $image = '';
   
   if ( has_post_thumbnail() ) {
   
     $image = get_the_post_thumbnail( $post->ID, 'medium', array(
       //  'title' => $title_attribute,
         'alt'   => $title,
       ) ) ;
     }
  
     
$dateday = substr($post->post_date,0,10);
        ?>
                    <div class="col-lg-4 col-md-6">
                        <div class="single-blog" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                            <div class="blog-image">
                                 <a href="<?php the_permalink(); ?>"><?php echo $image;?></a>
                            </div>

                            <div class="blog-content">
                                <h3>
                                   <a href="<?php the_permalink(); ?>"><?php echo $title;?></a>
                                </h3>
                                <div class="post-meta">
                                    <?php echo $dateday?>
                                </div>
                                <p><?php echo $excerpt?></p>
                            </div>
                        </div>
                    </div>
<?php endwhile; ?>
                </div>
            </div>
        </section>
        <!-- End Blog Area -->