Search code examples
wordpressposts

Change number of posts to display


How do I tell Wordpress to change the number of posts to display depending on the type of page being shown? For example, all Search results will show 10 posts at a time while Archives will show 20 posts at a time, etc.


Solution

  • what you have to do is to deal with the query_post() function.

    See this codex page : http://codex.wordpress.org/Function_Reference/query_posts

    You will then have to modify your archive.php and search.php files (depending on your theme) to call this function right before the loop.

    All is described in a pretty simple example here

    Hope this will help ;)