Changing # of posts per page on 2nd and subsequent pages…

Community Forums Forums Design Tips and Tricks Changing # of posts per page on 2nd and subsequent pages…

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Susan 1 year, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1270

    Susan
    Moderator
    Post count: 9255

    My website: http://www.affordyourpassions.net

    I have my blog set up with a slider on the front page; a featured post, and then 7 additional grid (magazine?) posts, for a total of 8 posts on the home page.

    The front page content length aligns pretty closely with the sidebar content.

    On the 2nd and subsequent pages, there are 8 posts per page, but without the featured image, or the featured post, the sidebar content extends much further, so there is a lot of white space.
    Is there a way to change the number of posts on 2nd and subsequent pages, so that I have more grid posts so that it matches the length of the sidebar?


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    • This topic was modified 1 year, 11 months ago by  Susan.
    • This topic was modified 1 year, 11 months ago by  Susan.
    #1276

    nickthegeek
    Keymaster
    Post count: 751

    You wouldn’t believe how difficult that is to do correctly. You need to use the pre_get_posts action to set the correct number of posts on the front page and then if is paged you set a different number of posts and use an offset to make sure things don’t get missed. Because of the way the offset works you must have more posts on the first page and fewer posts on subsequent pages.

    Getting more posts on subsequent pages doesn’t work nearly as well because you can’t do a negative offset

    #1281

    Susan
    Moderator
    Post count: 9255

    Thanks, Nick, for the prompt response!  I’ll either have to live with it, or do something about the sidebar :)


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Changing # of posts per page on 2nd and subsequent pages…’ is closed to new replies.