Wednesday, July 17, 2013

Display all posts of a category in Wordpress

In most cases query_posts() function will limit the number of posts from category based the reading input in settings.

To overcome this, pass the parameters to query_posts() as below

 query_posts( array('category_name' => 'some-category-name', 'posts_per_page' => '-1' )); 

In this 'posts_per_page' parameter should be set as -1.

No comments:

Post a Comment