12th Dec '23
/
0 comments

Child Posts Section in Bricks

This Pro tutorial provides the steps to limit the posts (can be of any post type) output by Bricks' query loop to children of the current single post being viewed on the front end.

Note: The post type should be set to be hierarchical with Page Attributes support.

We shall also ensure that the Section gets rendered only if there is at least 1 child for the current post.

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

Get access to all 625 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
ACF Post Object Query Loop inside a Posts Query Loop in Bricks

ACF Post Object Query Loop inside a Posts Query Loop in Bricks

How to loop through a CPT and within each post, output a list of related posts.
Categories:
Pro
WordPress Posts using WP REST API in Bricks

WordPress Posts using WP REST API in Bricks

The steps to display posts from any WordPress site that has WP REST API enabled in Bricks builder using a custom query type.
Categories:
Pro
6 Random Featured Posts in Alphabetical Order in Bricks

6 Random Featured Posts in Alphabetical Order in Bricks

How to output x number of random posts with a specific meta value set, in Alphabetical order.
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
Post Views Counter Query Loop in Bricks

Post Views Counter Query Loop in Bricks

How we can output the most viewed posts in your Bricks site in a query loop.
Categories: