wordpress代码

wordpress首页 产品list代码

  <?php 
    $args         = array(
      'post_type' => 'post',
            'posts_per_page'      => 10,
            //'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="">
                        <div class="portfolio-box">
                            <div class="portfolio-img">
                                <a href="<?php the_permalink(); ?>"><?php echo $image;?></a>
                            </div>
                            <div class="portfolio-text">
                               <a href="<?php the_permalink(); ?>"><i class="fa fa-long-arrow-alt-right"></i></a>
                               
                                <h4><a href="<?php the_permalink(); ?>"><?php echo $title?></a></h4>
                            </div>
                        </div>
                    </div>
                  <?php endwhile; ?>