wordpress首页调用指定分类下的文章

 1 <?php  
 2             $args=array(  
 3                 'cat' => 12,   // 分类ID  
 4                 'posts_per_page' => 8, // 显示篇数  
 5             );  
 6             query_posts($args);  
 7             if(have_posts()) : while (have_posts()) : the_post();  
 8             ?>  
 9                 <div class="col-md-3">
10                     <div class="pic"><a href="<?php the_permalink(); ?>"><img class="vcenter" src="
11                     <?php $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
12                     echo $full_image_url[0];?>" 
13 alt="<?php the_title(); ?>" /></a></div>
14                     <a class="inpca" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
15                     <p class="text-center">参考价格:<?php echo get_post_meta($post->ID, "jiage", $single = true); ?>万元/台</p>
16                 </div>
17             <?php  endwhile; endif; wp_reset_query(); ?>  
原文地址:https://www.cnblogs.com/juebai/p/9549044.html