Prefiltering Posts for customizing Query in Bricks

Updated on 29 Oct 2022

Bricks has an excellent filter called bricks/posts/query_vars for modifying the query of Posts and Product elements to modify the query with dynamic values and options not available in the editor.

In this Pro tutorial, we share a few practical examples of using this filter to filter the posts' output to

while ensuring that the correct instance of the Posts element is targeted.

Posts published in the specified year

Add a Posts element.

Then add the following in child theme's functions.php or a code snippets plugin like WPCodeBox:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro