[Solved] Change the number of posts on archive pages
Been searching for how to do this for a while – the solution became much easier when I realised (Doh!) that it was the wordpress loop that controlled the number of posts being displayed per page rather than the theme.
First tried blogmum’s suggestion of using:
<? query_posts('showposts=3'); ?>Add this to archives.php to change the number of posts in category, date and author archives; to search.php to change search results’ pages, or to index.php for the front page (as ever, this holds true for the majority of themes, but not absolutely all). The line needs to go *before* the loop if ( have_posts() )... etc. Change the number to whatever number of posts you want.
However, this only showed all the categories posts which wasn’t any good for me as the archive pages are category based.
Wordpress documentation gave me the correct solution.
<?php
global $query_string;
query_posts($query_string . "&posts_per_page=11");
?>
Note: Place a call to query_posts() in one of your Template files before The Loop begins. The wp_query object will generate a new SQL query using your parameters. When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category). If you want to preserve that information, you can use the $query_string global variable in the call to query_posts(), as above.

Leave a Reply