Wordpress 指定某个分类的文章到首页显示

作者:Jesse Lee • 2006年07月15日 06:49 • 查看 3,034 次 • 打印本文

If you are finished with the posts in the original query, and you want to use a different query, you can reuse the $wp_query object by calling query_posts() and then looping back through. The query_posts() will perform a new query, build a new posts array, and reset the loop counter.

 // Get the last 10 posts in the special_cat category.
  <?php query_posts('category_name=special_cat&showposts=10'); ?>

  <?php while (have_posts()) : the_post(); ?>
    <!-- Do special_cat stuff... -->
  <?php endwhile;?>

http://codex.wordpress.org/The_Loop#Multiple_Loops

评论

发表评论