Related Posts using Meta Box in Bricks

Updated on 12 Apr 2024

This Pro tutorial provides the steps to show posts set as related to the current single post via a Meta Box Post-type of field in Bricks.

Note

This can be applied to entries of any post type, not just post.

Step 1

Create a custom field group having a Post type of field.

Tick "Multiple".

Step 2

Edit your entries and selected the related posts.

Step 3

Edit your single post template with Bricks.

When done the structure should look like this:

Add a Section and inside its Container, a Related Post h2 heading and another Related Posts h2 heading.

We shall apply conditions on these headings to output them depending on whether there's 1 related post or more than 1.

Add a Container and inside it, a Block.

Enable query loop on the Block.

Click the loop icon and enable PHP query editor.

Paste:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro