Parent post Bricks query loop

Updated on 5 Feb 2024

In the BricksLabs Facebook group a user asks:

Is there a way to output the data of a parent post in a child post?

Are there tutorials for this?

This Pro tutorial provides the steps to output the current single post's parent post using a Bricks query loop for hierarchical post types.

When viewing the child post:

Step 1

Create and edit your single post type template with Bricks.

Add a Section for showing the parent post data (bottom Section in the screenshot).

Sample JSON provided near the end for copy-pasting.

Set up a query loop inside.

Click the query icon and enable 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 526 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Load more for Query loops in Bricks

Load more for Query loops in Bricks

Did you know that Bricks has AJAX loading for query loop posts on-click out of the box?
Categories:
Pro
Excluding Duplicate Posts from Query Loops in Bricks

Excluding Duplicate Posts from Query Loops in Bricks

How to ensure that posts are not duplicated when two query loops are used on the same page.
Categories:
How to create filters with IsotopeJS in Bricks (Part 4): AJAX filter and infinite loops, Sorting, List view and Disable animations

How to create filters with IsotopeJS in Bricks (Part 4): AJAX filter and infinite loops, Sorting, List view and Disable animations

This tutorial will explain how to enable the AJAX filter with an infinite scroll query loop container, how to add a sorting function, how to…
Categories:
Pro
Events grouped by Event Date custom field in Bricks

Events grouped by Event Date custom field in Bricks

This Pro tutorial for Bricks users provides the steps to output posts of an event custom post type dynamically grouped by the value of their…
Categories: