Setting a Bricks template for Parent pages

This Pro tutorial shows how bricks/active_templates filter can be used to programmatically assign a Bricks template to all singular pages (of any post type) that are parents i.e., have other child pages (of the same post type).

The code snippet can also be modified to only apply to parent posts of a specific post type, if needed.

Add the following in child theme's functions.php or a code snippets plugin:

Step 1

Create a Bricks template of "single" type named say "Parent page".

Edit it and add your desired elements inside.

Go to the list of templates and note the template ID.

Step 2

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