50% discount on BricksLabs Pro Membership Lifetime Access. Use coupon: GOBRICKS

Building Prev / Next Posts with Query Loops in Bricks

Prev next posts in Bricks

Following on from our tutorial on Adding Custom WP_Query Loops in Bricks, in this pro tutorial we'll walk through the process of using those same Bricks' filters to allow us to build custom adjacent posts ( or prev/next posts ) for use on a single post template.

We can then set up this query on the container element, meaning we can then build the layout how we like by placing elements inside and using any dynamic data from those posts. This gives us much more flexibility than using the native 'post navigation' element.

Adding the Adjacent Post Query

This code would need to be added outside of the builder, either inside your child theme’s functions.php file or a code snippet manager such as WPCodeBox.

This is a Pro members-only tutorial.

To get full access, login below or sign up for a Pro Account

  • Sebastian Albert

    Hello,
    Thanks for the tutorial.
    I have the post archive sorted by a ACF number value. Is it possible to align the sorting of the prev/next button to the same ACF number value?
    If I implement the code as is, the sorting of the archive and the prev/next buttons does not line up, as they seem to be sorted by a different value.

    Thanks!

    • Sebastian Albert

      Sadly there is no answer for over 1 month…. Hello????

Leave your comment