WordPress.org

Ready to get started?Download WordPress

Forums

Change Posts Per Page when Paginated (2 posts)

  1. jmccall
    Member
    Posted 3 years ago #

    Is it possible to alter the posts per page according to whether or not you're on the homepage or a paginated archive of the home page?

    This is my issue. My index page is a grid of ten post thumbnails, i.e., 2 rows of 5. On the homepage, I have a feature post and then 9 regular posts, for a total of ten posts. For this to work, in the reading panel I have to set "blog pages to show at most" to 9 because, apparently, the feature post (which is in its own loop) doesn't count toward the max posts.

    Which is fine until I click the next_posts link. Now the feature post goes away (which is what it should do) and I'm left with only 9 posts and a broken grid (a row of 5 and 4, instead of two rows of 5).

    Is there a way to alter the max posts according to whether you're paginated or not?

    Thanks.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Is it possible to alter the posts per page according to whether or not you're on the homepage or a paginated archive of the home page?

    Yes - using a mixture of query_posts and some conditionals.

Topic Closed

This topic has been closed to new replies.

About this Topic