Consider the following setup:
CPT: Events
ACF Fields:
Event Date Information (Group)
|__Event Date (Date Picker)
Pick Sub Events (Relationship)
An Event can have 1 or more related events via the Relationship field.
When the ACF Relationship is selected as the query type of a Bricks query loop, the event posts will be ordered by their post editor visual order by default. There are no query controls to set the post order with a Relationship type of (and a few other types) of query in Bricks.
The objective is to order the posts by event date in ascending order.
This Pro tutorial shows how this can be done using the bricks/query/result filter.
Step 1
Note: The return format of the date field does not matter and can be any (like m/d/Y
). Internally, it gets saved in Ymd
format in the database.
Set up a ACF Relationship query loop.
Step 2
Add the following in child theme's functions.php
(w/o the opening PHP tag) or a code snippets plugin:
This is a BricksLabs Pro tutorial.
For full access login below or create your BricksLabs Pro account