When using WordPress, I often see the need to display a different number of Posts in different contexts. Maybe I just want to display the five newest on the frontpage, but show 50 (with just the headlines) when browsing Archives, etc. WordPress doesn’t let you do this – at least not from the Dashboard – in Reader Settings there’s only one field that lets you set the number of Posts, which is used all-over (defaults to 10).
But there are ways around this. The plugin Custom Query String Reloaded lets you set a different numbers of Posts for everthing from the frontpage, to archives and categories.
You don’t need to use a plugin, however, if you know your way around your Theme-files. To change the number of displayed Posts, you simply need this little code snippet:
<?php query_posts('posts_per_page=5'); ?>
Insert it above the Loop in your template-files, and change the number to the number of Posts you want to display. Remember to use Conditional Tags if you want different results on different pages. For example, if you want to show five Posts on the frontpage only, you add this code above the Loop in your
<?php if(is_home()) query_posts('posts_per_page=5'); ?>
The Loop (usually) starts with the line
<?php if (have_posts()) : ?>, so insert your code above this.
This can be used in practically every template-file that deals with multiple Posts;
category.php, and so forth.