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 BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get full access to all 220+ Bricks tutorials with BricksLabs Pro

7 comments

Leave your comment