7th Aug '23
/
3 comments

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 custom field created using Meta Box in a query loop.

Field group:

Location of the field group is a CPT: Project (project).

Field being populated on a project CPT post:

Bricks editor:

After implementing the tutorial, the project entry on the front end:

Note: The actual HTML output i.e., values of a Checkbox list field is not the focus here as it can be done by simply copying the code that Meta Box generates and pasting in a Code element. The point is to see an example of how we can basically loop through items of any array in Bricks in a query loop.

Step 1

Register your CPT (if needed), add the field group with a Checkbox List field as shown above (field ID: services_provided), populate the field while adding/editing your CPT items.

Step 2

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

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Meta Box Group’s Number Sub Field Values Sum

Meta Box Group’s Number Sub Field Values Sum

In the Bricks Facebook group a user asked: We can define a custom function that takes a Meta Box group ID, the sub field ID…
Categories:
Tags:
Pro
Meta Box Relationship Posts Filtered by a Taxonomy Term in Bricks

Meta Box Relationship Posts Filtered by a Taxonomy Term in Bricks

Updated on 17 Feb 2025 In the Inner Circle a user asks: Hello, I have a relationship made in metabox between two Post Types “Travel”…
Categories:
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: