• Hi there,

    I’ve got a problem I can’t seem to solve…
    On a page displaying posts from a custom post type called ‘news-item’, I want to change the number of posts displayed on page 2 and further. This because I want the newest (first) post displayed bigger then the rest, but therefore the layout/grid has to change too. So for example:

    On Page 1:
    1 Large post
    4 normal posts
    —————
    5 total

    On Page 2:
    6 normal posts
    —————
    6 total

    The part that the first post has to be bigger on page 1 works, but I can’t seem to change/set/update the posts_per_page parameter inside the loop in order to add it with 1. Is that even possible without making a second wp_query?

    I tried it with:
    set_query_var( 'posts_per_page', 4 );
    and:
    $args -> set( 'posts_per_page', 4 );
    but that’s not working and messing up my pagination.

    My code: https://pastebin.com/hR6K4Wtj

    ANY help is welcome!
    Many thanks!

Viewing 16 replies (of 16 total)
Viewing 16 replies (of 16 total)
  • The topic ‘Change posts_per_page inside loop?’ is closed to new replies.