Meta Box Cloneable Field Query Loop in Bricks

This Pro tutorial provides the steps to create a custom query type for outputting the values of one or more instances/items/rows of a cloneable custom field created using Meta Box in Bricks.

This is similar to our earlier Looping Through a Cloneable Meta Box Sub Field in Bricks tutorial.

Note 1: Bricks has built-in support for a Meta Box group. But there could be certain times when you don't want to use a group-type field and hence this tutorial.

Note 2: It is probably easier/simpler/faster to just use a Code Block and output the values of your cloneable field using the code that Meta Box generates than implementing this tutorial.

If you want to use Bricks elements like Basic Text for the output for visual styling though, follow along.

We shall also ensure that the parent Section gets output only if there is at least one item of the cloneable field.

Let's take an example of a Course CPT that has a cloneable "Course Date" Date Picker field.

and for a particular course, the field is populated like this:

Step 1

Add the following 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

Instant access to 390+ Bricks code tutorials with BricksLabs Pro