Support » Fixing WordPress » Posts Per Page

  • Resolved jcattanach


    I would like to have just 1 post on my index page and up to 7 posts on my archive pages. I changed my posts per page in my admin section to 7 and then added the following line of code (before my loop) on my index page:

    <?php query_posts(‘posts_per_page=1’);?>

    This seemed to achieve my goal but when I went to all my individual post pages, the pages that end in “/?p=9” (a different number for each page), all the pages bring back the same post that is on my index page.

    I’ve been working most of the morning at this and would love any help that someone can offer.

    You can view the site at:


Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Go to options, permalinks, and hit the Update Permalink Structure button. Might not work, but it’s worth a try.

    Thanks for your suggestion but this never worked. Any other ideas?

    Query posts stomps all over any other URL (such as those generated by your individual post pages). Have a search for the plugins ‘Custom Query Strings’ or ‘Per Pages’ which should allow what you want without needing query posts.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Ahh… I understand now.

    You could also try changing your query line to this:
    <?php if (is_home()) query_posts(‘posts_per_page=1’);?>

    That will make it only have any effect on the main home page, and not on any sub pages.

    Thank you – worked like a charm.

    I will also checkout the plugins for future reference.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Posts Per Page’ is closed to new replies.