Looping Through a Cloneable Meta Box Sub Field in Bricks

This Pro tutorial shows how a custom query type can be set up in Bricks to render YouTube videos (via the built-in Video element) whose IDs are taken from value of a cloneable sub field of a group field.

We shall first loop through the group field (functionality built in Bricks) and inside that, loop through the sub-field (made possible via custom query type) i.e., make nested query loops.

Scenario:

CPT: course

Meta Box field group:

events field being populated on a course post:

Structure of single course template:

Output on the frontend:

We shall ensure that if the video_id sub field is empty, the entire videos Section does not get rendered.

Step 1

Add this in child theme's functions.php 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 526 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Meta Box Checkbox List Query Type in Bricks

Meta Box Checkbox List Query Type in Bricks

This Pro tutorial provides the steps to add a new query type in Bricks builder for displaying the values of a Checkbox List type of…
Categories:
Pro
Meta Box Color Picker to CSS Custom Property Workflow in Bricks

Meta Box Color Picker to CSS Custom Property Workflow in Bricks

This Pro tutorial provides the steps to declare a custom property (CSS variable) whose value is equal to the post-specific color set via a custom…
Categories:
Tags:
Modifying ACF Field Value Before It Is Output

Modifying ACF Field Value Before It Is Output

Consider the scenario where a Page has a "Page Fields" field group created with ACF Pro like this: Field name: scientific_coordinators (type Repeater)|__ Sub field…
Categories:
Pro
Conditionally Hiding Bricks Filters based on Select Filter Value

Conditionally Hiding Bricks Filters based on Select Filter Value

How show or hide Bricks' filter based on the selection made by another filter.
Categories:
Tags:
Pro
Parent Query Loop Object – Traversing Nested Query Loops Up in Bricks

Parent Query Loop Object – Traversing Nested Query Loops Up in Bricks

Bricks enables us to build nested query levels of unlimited levels. Here are a couple of examples: Sometimes, you might want to obtain the parent…
Categories:
Pro
CPT Posts Grouped by Custom Taxonomy Terms in Bricks

CPT Posts Grouped by Custom Taxonomy Terms in Bricks

The steps to set up a Service Category terms loop with an inner Service posts loop in Bricks without writing code.
Categories:
Pro
Bricks Query Loop for Top-level Parent Pages with Children

Bricks Query Loop for Top-level Parent Pages with Children

In the Bricks Facebook group, a user asked: Looking for a custom query to output a list of posts in the same hierarchy that the…
Categories: