19th Mar '23
/
0 comments

Nested Meta Box Query Loop Inside a CPT Query Loop in Bricks

This Pro tutorial provides the steps for setting up a cloneable Meta Box group query inside a CPT query in Bricks.

Scenario:

CPT: course

Meta Box field for the course CPT: events of the type Group and cloneable with these sub fields: Start Datetime and End Datetime - both of the type Datetime Picker.

CPT item 1 (Course 1):

CPT item 2 (Course 2):

A static Page having the nested query loops on the front end:

Step 1

Set the Save format for your Datetime Picker fields to Y-m-d H:i:s.

Tick "Save value as timestamp".

If your CPT entries already have the fields populated prior to making the above two changes, edit them, re-select the date and time and update.

Step 2

Edit any static Page with Bricks.

By the end of this tutorial, the structure should look like this:

Add a Section and inside its Container a "Our Courses" h2 heading.

Add a Container below the Heading.

Add a Block inside and change its name to say, "Course CPT Loop".

Enable the query loop on it and set the Post type in query settings to Courses.

Add a h3 Post Title element inside the Block.

Add a Block below the Post Title.

Change its name to say, "Events Field Loop".

Enable the query loop on it and set the Query to "MB Group: Events".

Step 3

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
Conditionally outputting an element in a Query Loop based on date-type custom field

Conditionally outputting an element in a Query Loop based on date-type custom field

This Pro tutorial shows how to output an element in a Bricks' query loop only if the value of a date-type of custom field for…
Categories:
Bricks Templates Query Loop

Bricks Templates Query Loop

How display Bricks Templates with saved screenshots in a query loop.
Categories:
Pro
Upcoming Events with ACF Date Sub field Repeaters grouped by Month Years in Bricks

Upcoming Events with ACF Date Sub field Repeaters grouped by Month Years in Bricks

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…
Categories:
Pro
Sort Posts by Meta Box Group Sub Field in Bricks

Sort Posts by Meta Box Group Sub Field in Bricks

This Pro tutorial provides the steps to order posts in Bricks by the value of a Number-type of sub field that is inside a Meta…
Pro
“My Favorites” in Bricks

“My Favorites” in Bricks

This Pro tutorial provides the steps to set up and use My Favorites in Bricks Builder.
Categories:
Posts Related by Current Post’s Terms in Bricks

Posts Related by Current Post’s Terms in Bricks

Showing other posts assigned to the same categories/tags/custom taxonomy terms as the current post.
Categories:
Pro
Non-empty events sorted by event date and other posts below in Bricks

Non-empty events sorted by event date and other posts below in Bricks

Updated on 15 Jan 2024 Consider a scenario where you are showing posts from multiple post types namely post, event and game in a single…
Categories: