DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

By default, the WordPress loops displays 10 posts per page. But in case you’d like to display more or less posts, here’s how to achieve it.

The solution to that common issue is pretty simple: You have to use the query_posts() function, which gives you a total control over the WordPress loop.

To specify how many posts you want to be displayed per page, we’ll use the showposts parameter.

Here’s an exemple:

$page_num = $paged;
if ($pagenum='') $pagenum =1;
query_posts('showposts=7&paged='.$page_num); ?>
               	<?php if (have_posts()) : ?>
		<?php while (have_posts()) : the_post(); ?> 
                // WordPress loop
                endwhile;endif; ?>

This exemple loop will displays 7 posts per page. This is the code I use on WpRecipes.
Did you noticied the paged=’.$page_num parameter? This allows use to display our content by pages and use a paginator.


  1. Excellent explanation, answered my question perfectly! Thank you. How do you recommend handling the bottom of the page? Link to Archived posts so the page isn’t a dead end at the bottom?

  2. Where do i place this code?

  3. Great tip! I looked on more than 10 webs and didn’t find the solution. Until now…

    Thanks so much!

  4. I knew there must be a way to do this with out all that plugin bullshit! Great solution mate. Really appreciate it.

  5. Thanks alot, i have searched for this solution a long time.

  6. Hi there!
    Thanks for posting this, it helped me a lot.
    However, it seems to be incompatible with my page titles. I currently use ” » ” but whenever it’s in page 2 it displays “(blogname) > Page Not Found”. Do you know how I can change this?


  7. I have a problem too, I am using wordpress (online version) where plugins is not possible to input (or I am wrong?). How i can restrictnumber of post to 10? And this cods that you all are writing, where should I put it???
    Thanks very much!

  8. Where do i place this code? X 2

  9. Where do we place this code times 1million..? No I’m lost!

  10. Yes please, where am I supposed to place this code?

  11. @UP,UP2,UP3… Apparently nobody gives a fck about people that just want to change the post count on their page, gotta learn the whole freakin wordpress codex. If I’m wrong please just tell where to place this function.

  12. place it before the loop.

Leave a Comment

Your email address will not be published. Required fields are marked *