21st Mar '24
/
12 comments

The Perfect Bricks Page Template

Updated on 9 May 2026

I don't know about you but this is how I want Pages to be rendered when using Bricks:

  • When a Page has only WordPress content (Gutenberg blocks), the title and the WP content should show.
  • When a Page has only Bricks content, Bricks content should show.
  • When a Page has both WordPress and Bricks content, the Page title + WP content AND Bricks content should show.

This Pro tutorial shows how such a (what I consider the) perfect Page template can be set up in Bricks.

First, some sample screenshots.

WP content only

Bricks content only

WP and Bricks content

This one-time setup does not involve a custom fields plugin or constant Page-by-Page maintenance/decision-making.

Step 1

(JSON export near the end)

Create a Bricks template named say, "Page" of type Single.

Edit it with Bricks.

Set a condition to make it apply to all Pages.

Set up the structure like this:

Data source for the Post content element inside the "WP Content Section" should be the default i.e., WordPress.

The "Bricks Content" is another Post content element whose Data source is set to Bricks.

Apply this Dynamic data condition on WP Content Section:

{echo:bl_has_wp_content}

JSON Export of the Page (can be imported on the Bricks template screen)

Note: There is no need to apply a condition on the 'Post content' element whose source is set to Bricks. It will automatically only be output if there is Bricks content.

Step 2

Add the following in child theme's functions.php (w/o the opening PHP tag) 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 632 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Bricks Setup Guide

Bricks Setup Guide

In this tutorial, we share the steps for setting up Bricks builder from scratch.
Categories:
Tags:
Pro
Condition for checking Bricks content

Condition for checking Bricks content

Only outputting Bricks content when a Page is built with Bricks, otherwise display WP content.
Categories: