10th Mar '23
/
3 comments

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

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Featured Image Fallback in Bricks

Featured Image Fallback in Bricks

This Pro tutorial shows bricks/element/settings filter of Bricks builder can be used to specify the ID of an image in the WordPress Media Library that…
Filtering out Media Items from “Select post/page” Bricks control

Filtering out Media Items from “Select post/page” Bricks control

The dropdown that appears after choosing "Internal post/page" when setting a link in Bricks shows media (attachment) items besides Pages, Posts and other CPTs. If…
Pro
Programmatically populating ACF field values in WordPress

Programmatically populating ACF field values in WordPress

An example of how to set the values of a Select-type field with the names and labels of all public post types.
Categories:
Pro
Outputting Only the First ACF Repeater Row in Bricks

Outputting Only the First ACF Repeater Row in Bricks

Updated on 12 Dec 2023 In the Bricks Facebook group a user asks: How can I display only the first entry from an ACF repeater?…
Show Product Categories Count Using Bricks Filter Hook

Show Product Categories Count Using Bricks Filter Hook

Unable to find terms count from the Dynamic Data provided by Bricks theme? It's okay, this simple tutorial shows you how to properly get the…
Categories:
Tags: