WordPress.org

Forums

[resolved] Posts Per Page (6 posts)

  1. jcattanach
    Member
    Posted 9 years ago #

    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: http://www.mentalhealthlearning.com

    Thanks,
    Jacquie

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

  3. jcattanach
    Member
    Posted 9 years ago #

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

  4. iand
    Member
    Posted 9 years ago #

    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.

  5. 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.

  6. jcattanach
    Member
    Posted 9 years ago #

    Thank you - worked like a charm.

    I will also checkout the plugins for future reference.

    Jacquie

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags