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

Related Tutorials..

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
ACF User Field Bricks PHP Query

ACF User Field Bricks PHP Query

In the Bricks Facebook group a user asks: my end goal was to create a set of cards that would display the Users that are…
Categories:
Pro
Ordering Posts by Terms in Bricks

Ordering Posts by Terms in Bricks

How to output upcoming events at the top and past events below in a single query loop in Bricks.
Categories:
Color Custom Field as Section Background Color on Category/Term Archives in Bricks

Color Custom Field as Section Background Color on Category/Term Archives in Bricks

How to use a color from a taxonomy term custom field for as the hero section background color on archive pages.
Categories:
Tags:
Pro
Query Loop in Bricks

Query Loop in Bricks

This Pro tutorial walks you through the steps to use the Query Loop feature in Bricks to display a responsive grid of posts using CSS…
Categories:
Pro
Parent post Bricks query loop

Parent post Bricks query loop

Updated on 5 Feb 2024 In the BricksLabs Facebook group a user asks: Is there a way to output the data of a parent post…
Categories:
Pro
Masonry for Query Loop in Bricks

Masonry for Query Loop in Bricks

If you are looking to implement masonry with a 'view more' button i.e., click-type of infinite scroll follow this tutorial instead. Updated on 15 Mar…
Categories: