If this displays posts with category ID of 20 with pagination
query_posts('paged='.$paged.'&cat=20');
how do I display all posts with category ID of 20 without pagination and without going into Dash开发者_StackOverflow中文版board -> Reading -> Blog Posts Show at Most?
I got it to work like this.
<?php
query_posts(array('cat'=>20,'posts_per_page'=>-1));
?>
This one is even better as it does not affect the original loop.
<?php $posts = new WP_Query(array('cat'=>20,'posts_per_page'=>-1)); ?>
Use get_posts
instead and write your own loop.
精彩评论