1st Jul '24
/
4 comments

Upcoming Events Grouped by ‘Month Year’ in Bricks

Updated on 5 Dec 2024

In the comments section of Events grouped by months within years based on event date custom field value tutorial, a member asked:

... A good update for this would be a single loop of just MONTH YEAR with the events under each Month and Year, rather than YEAR, then MONTh then events.

This Pro tutorial is another example of custom advanced Bricks query loop types for showing future posts of event CPT based on a date custom field using three nested query loops.

The Heading element's text is dynamic and automatically pulls data from the Event Year and Event Month query loop objects.

Similarly, the Post Loop pulls the year and month from the parent queries, passes them to a custom function which returns the IDs of posts from that year and and that month.

Events list:

Output on the front end after implementing the tutorial:

Step 1

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 626 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Posts older than today in Bricks

Posts older than today in Bricks

How to display only posts that were published before today in a query loop.
Categories:
Pro
ACF Relationship Select Filter in Bricks

ACF Relationship Select Filter in Bricks

In the BricksLabs Facebook group, a user asks: I'm learning about ACF relationships and attempting to output a list of posts on any given page,…
Categories:
Pro
Sorting ACF Relationship Posts by Date Meta in Bricks

Sorting ACF Relationship Posts by Date Meta in Bricks

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…
How to create parallax effects using Rellax.js in Bricks

How to create parallax effects using Rellax.js in Bricks

This tutorial provides the JS & PHP codes that can be pasted in order to create smooth parallax effects using the Rellax.js library inside Bricks…
Categories:
Latest Featured Posts First in Bricks Query Loop (No Duplicates)

Latest Featured Posts First in Bricks Query Loop (No Duplicates)

In the Bricks Facebook group a user asks: We can use AI to help unfreeze our brains sometimes or at least have it write the…
Categories:
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:
HappyFiles Bricks Query Loop

HappyFiles Bricks Query Loop

This tutorial explores different ways in which images from WordPress Media Library organized via HappyFiles can be pulled and shown in Bricks using query loop(s).…
Categories:
Pro
Single Event Template for The Events Calendar in Bricks

Single Event Template for The Events Calendar in Bricks

Updated on 19 Sep 2024 The Events Calendar is one of the most popular event plugins for WordPress. With The Events Calendar active, single event…