In the comments section of Upcoming Events Accordion in Bricks Grouped by 'Month Year' a member asked:
CPT: eventACF Field: event_dates (Repeater) with event_date sub field
Sample data:

After implementing the tutorial, the output with Bricks elements for the month years, event titles and dates using nested query loops:

This Pro tutorial provides the steps to
- add a custom query type called 'Month Years' to Bricks control options
- configure how the query runs by checking for our custom query type
- query and retrieve all event posts
- process each event's dates using ACF repeater fields
- filter out past events, keeping only future dates
- format each event's date information (day, month, year, weekday)
- sort all events chronologically
- group events by month and year
- create a helper function to handle Bricks loop objects
- build a function to retrieve specific event values (day, month, year, weekday) by Bricks ID
- and use these to set up nested query loops for outputting the data in the desired format
Step 1
If you have not already, create the CPT and the field group.
Ensure that the return format of the date field is Ymd.


Create event posts and set all the dates on which each event is set to occur.

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
