Support » Fixing WordPress » Home page needs different # of posts than category page

  • Matt


    Clicking on I’d like to show 100 posts. This uses my theme’s index.php template.

    Clicking on the site’s index page I’d like to show 8 posts. This uses my theme’s home.php template.

    Problem is they both display whatever I define in Settings->Reading->Blog pages show at most

    What can I do to free one of these from this setting?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Matt


    Rephrase: how do I make a “manual” loop, one that isn’t subject to the “show # posts” setting?



    Nobody has this requirement but me?

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Put this <?php query_posts('showposts=10'); ?>

    Before this: <?php while (have_posts()) : the_post(); ?>

    Change ’10’ to however many you want to show. Party on, Garth.

    Yes, you can modify the loop in home.php to show a specific number of post :

    You should have something like this in your home.php :

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    Change it for :

    $posts = query_posts($query_string .
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    Here, we show 8 posts… Note the : &showposts=8. You can set it to anything you like.

    Now, your home.php uses this modified loop, and your index.php still use the default one to display the categories…

    Also, read this codex page :




    Thanks Simon and Ipstenu.

    Ipstenu, <?php query_posts('showposts=10'); ?> blew up my category filter, so that each category page showed every post.

    Is anyone having issues with the code posted by Simon in wp 2.8.4? This code was working great until I updated (I think that’s when it broke…) I now get an error page.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Home page needs different # of posts than category page’ is closed to new replies.