Customizing ACF Repeater/Relationship or Meta Box Relationship Query Parameters in Bricks

For query types other than post, term and user in Bricks i.e, ACF Repeater/ACF Relationship/Meta Box Relationship there are no built-in controls for modifying the parameters like being able to limit the result count or show the results in random order.

But Bricks does provide a filter to do this programmatically called bricks/query/run.

This Pro tutorial shows a usage example.

Let's say you have a Meta Box Relationship between two Custom Post Types called "Service to Review".

Now, in the single service template you want to show the review CPT posts that are related via this relationship.

To limit the posts count to say 4 and to show them in random order, add the following in child theme's functions.php or a code snippets plugin:

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