[Support request] Whats the best way to add a second loop on a page in blog format?

Home Forums Support [Support request] Whats the best way to add a second loop on a page in blog format?

Home Forums Support Whats the best way to add a second loop on a page in blog format?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #411025
    Samuel

    I’m working on moving my site over to GP and my question is what is the best way to add a second loop on a page that displays in the blog format I have set. For example, on my existing site on a single page, after the post I display 6 related posts. For a page I list the 6 most recent posts at the bottom. I’m converting the site over from Genesis and it was fairly simple in Genesis because of a custom loop function. What’s the best way to in GP to set a custom query and then run the loop again with the proper html to display in the blog format I have set in the customizer?

    #411055
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You would have to write a custom page template to do that, or hook in a custom function with a new loop using one of the hooks: https://docs.generatepress.com/collection/hooks/

    Alternatively, you can use a plugin like this: https://wpshowposts.com/

    Let me know if you need more info ๐Ÿ™‚

    #411258
    Samuel

    That makes sense. I wanted to make sure this functionality didn’t already exist before I looked at another way. I am looking at WP show posts and so far I love it.

    I don’t know how difficult it would be to implement, but it would be nice to have a function in a future version you could call to produce the html listing blog posts. Something would allow for custom query args.

    Thanks!

    #411437
    Tom
    Lead Developer
    Lead Developer

    You could likely just copy one of the existing loops, then alter the WP_Query args for your custom loop. Then all of the styling/HTML would be the same.

    Glad you like the look of WPSP ๐Ÿ™‚

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