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

Related Tutorials..

How to List Your Posts Divided by Categories in Bricks

How to List Your Posts Divided by Categories in Bricks

In this tutorial, we'll learn how to display a list of posts divided by each category. The DOM tree Here is how I structured my…
Categories:
Pro
6 Random Featured Posts in Alphabetical Order in Bricks

6 Random Featured Posts in Alphabetical Order in Bricks

How to output x number of random posts with a specific meta value set, in Alphabetical order.
Categories:
Filtering Bricks Posts Query Loop by Meta Box Group’s Radio Subfield Value

Filtering Bricks Posts Query Loop by Meta Box Group’s Radio Subfield Value

In the past we showed how a Bricks posts query loop can be filtered by Meta Box group's subfield of types text/number and Datepicker here.…
Categories:
Pro
MB Favorite Posts in Bricks

MB Favorite Posts in Bricks

This tutorial explores using MB Favorite Posts in Bricks, including outputting the list of favorites via a query loop.
Categories:
Pro
Previous Two Posts in Bricks Query Loop

Previous Two Posts in Bricks Query Loop

This Pro tutorial shows how we can modify the parameters of a Bricks query to limit the posts to the previous two whilst cycling to…
Pro
How to Query WordPress Taxonomy Terms by Hierarchy Level in Bricks

How to Query WordPress Taxonomy Terms by Hierarchy Level in Bricks

How to limit the terms of a Bricks Terms query to only those at a specific level within the taxonomy hierarchy.
Categories: