[Resolved] Offset of posts archive ( pre_get_posts )

Home Forums Support Offset of posts archive ( pre_get_posts )

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1312490
    Ben

    Hi
    I have a hook that adds the latest 2 posts before the main list on blog archive (showing them large).

    Is there a way to then offset the results below so that these 2 arent listed in the blog archive?

    I’ve tried using pre_get_posts but it was giving strange results when clicking on the “Load more” button .

    Can you recommend best way to do this, just on the blog archive, as I have a number of other CPT posts that I dont want effected.

    Many thanks
    Ben

    #1312514
    David
    Staff
    Customer Support

    Hi there,

    offsetting the list of posts is a nightmare in WP – as it generally screws up the forward pagination, which also applies to Load More.

    Can you share a link to the site so i can take a look if theres an alternative solution?

    You can edit your original topic and use the Site URL field to share the link privately.

    #1312522
    Ben

    link added to original topic, many thanks

    #1312537
    David
    Staff
    Customer Support

    Ok – not got any new ideas.

    We did try this offset method with another user – they had some difficulties but had a different setup – maybe give this a try:

    https://generatepress.com/forums/topic/magazine-grid-2/#post-1277319

    #1312548
    Ben

    wow, thats awesome. Initial tests and it seems to work. I’ll keep testing but for now it looks good. Many thanks David!

    #1312561
    David
    Staff
    Customer Support

    Fingers crossed – hope it works 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.