17th Jul '24
/
4 comments

Upcoming Events Accordion in Bricks Grouped by ‘Month Year’

This Pro tutorial is a variation of the previous Upcoming Events Grouped by 'Month Year' in Bricks tutorial wherein the upcoming 'month year's are shown in BricksExtras Pro Accordion with the events corresponding to that month and year with the dates based on event_date post meta value.

Given this events list:

the output after implementing the tutorial as on 17 Jul 2024 would be:

We shall loop through the events, construct an array with the necessary data, set up a custom Bricks query type for the 'month year' query loop and an inner event posts query loop that uses the outer query loop object to pull the post IDs.

Step 1

Create the CPT and corresponding date-type custom field. ACF was used in our dev site.

CPT: event

Custom field: event_dateReturn format: Ymd

Create event posts and populate the event date field for each.

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

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Related Posts by Taxonomy in Bricks

Related Posts by Taxonomy in Bricks

In the previous Posts Related by Current Post's Terms in Bricks tutorial, we showed how posts related to the current single post that have the…
Categories:
How to display a Query Loop in 3 columns in Bricks

How to display a Query Loop in 3 columns in Bricks

This tutorial provides the builder settings and CSS codes that can be pasted in order to create a 3-columns query loop container inside Bricks Builder.
Categories:
Related Posts by Author in Bricks

Related Posts by Author in Bricks

Querying posts on single posts by the author of the current post.
Categories:
Pro
Upcoming Events in Bricks Grouped by ‘Month Year’ with Frontend Filtering by Event Type

Upcoming Events in Bricks Grouped by ‘Month Year’ with Frontend Filtering by Event Type

Updated version of the earlier Upcoming Events Grouped by ‘Month Year’ in Bricks tutorial with some improvements:
Pro
Posts Grouped by Month and Year in Bricks

Posts Grouped by Month and Year in Bricks

Nesting query loops with months & years in descending order, with the inner loop outputting the posts.
Categories:
Pro
Dynamic Horizontal Posts Accordion in Bricks

Dynamic Horizontal Posts Accordion in Bricks

Creating a horizontal accordion of featured images from posts output by Bricks' query loop.
Categories:
Tags: