3rd May '24
/
0 comments

Post sub field Bricks Query Loop in a Meta Box Group field

Post sub field Bricks Query Loop in a Meta Box Group field

Let's consider this Meta Box field group for Pages:

FAQs is a Group-type of field in which one of the sub fields is "Answer Post", a Post-type of field.

"Sample Page" being edited:

On the front end we want to show the question heading and below that, the content (rather the excerpt) of the selected answer post for each question as the answer.

Like this:

This Pro tutorial for Bricks users shows how we can loop through the FAQs Meta Box group and inside that set up another query loop to show the selected post's data. This is one of the few ways in which this problem can be solved.

Step 1

Edit the Template that applies to your post type or a specific Page with Bricks.

Add a Section and inside its Container, add a Block and enable query loop on it.

Select your Meta Box group as the query type.

You may want to add a Heading element and set its text to the Question sub field.

Step 2

Add a Block beneath the Heading.

Enable query loop and the PHP query editor.

Paste:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 626 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Bricks Templates Query Loop

Bricks Templates Query Loop

How display Bricks Templates with saved screenshots in a query loop.
Categories:
Pro
Meta Box Settings Fields in Bricks

Meta Box Settings Fields in Bricks

This Pro tutorial is the equivalent of our earlier ACF Options Fields in Bricks article but when using Meta Box. While retrieving the values of…
Categories:
Tags:
Pro
Term Parent Slug Data Attribute in Bricks

Term Parent Slug Data Attribute in Bricks

How we can set a data attributes on a child taxonomy dynamically based on the parent taxonomy.
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
How to Insert an Ad or an Element Between Posts in Bricks

How to Insert an Ad or an Element Between Posts in Bricks

How to insert an image or any Bricks element between posts output by a query loop.
Categories:
Tags:
Pro
Ordering Meta Box group rows by a sub field in Bricks

Ordering Meta Box group rows by a sub field in Bricks

In the BricksLabs Facebook group a user asks: Any idea how to set the sort order of a cloneable group in the query? In this…
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:
How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 2)

How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 2)

This tutorial provides the PHP & JS codes that can be pasted in order to create a flying effect on map markers each time your…