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

Related Tutorials..

Pro
Related Services grouped by Service Categories on Single Branch Posts in Bricks

Related Services grouped by Service Categories on Single Branch Posts in Bricks

How to query ACF relationship fields on single CPT templates.
Categories:
Pro
Dynamic Posts Lightbox in Bricks using GLightbox

Dynamic Posts Lightbox in Bricks using GLightbox

Steps to set create a dynamic lightbox with content from the post inside of the query loop.
Categories:
Adding any Custom WP_Query loop to Bricks’ Query Loop

Adding any Custom WP_Query loop to Bricks’ Query Loop

Sometimes we may need to create a custom post loop using Bricks' query loop feature, but wish to use our own WP_Query code for more…
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: