Let Users Choose a layout Template (Bricks & ACPT)

  • ACPT

Learn how to let users easily select layout templates with Bricks and ACPT, making template management simple and straightforward.

In this tutorial, I will guide you on how to let your website authors or editors pick different template layouts for their blog posts. This way, each author can have more control over how their blog looks.

As you can see in the video above, when a user finishes writing their blog and selects a template options, the blog header changes to match their choice. This feature allows editors or admins to change the post template easily without needing to go into the bricks template and change it manually.

Creating Field Group

First, we will create a field group and set the location to posts.

Dropdown menu for setting conditions: Location is "Post type," Condition is "is equal to," Value is "Posts." Option to add or delete conditions.

We will name this field group “Post Layout.” For the metabox, we will label it “Post Layout Control.” Inside the “Post Layout Control” metabox, we will add a meta field (or field box) and name the field label “Template.” Finally, we will choose the field type as “Radio.” Next, we need to create options for the radio buttons. We will add the radio options: “Template 1,” “Template 2,” and “Template 3.”

Screenshot of a content management system interface showing meta box settings for post layout. Options for template selection and fields like label, slug, and type are visible.

Make sure to set one of the radio options as the default value. This way, if the editor or admin forgets to choose a template, the default option will automatically show.

A web interface displaying a table with two columns, "Label" and "Value," each containing three text fields labeled "Template 1," "Template 2," and "Template 3." Various icons are beside the fields.

Creating Bricks Template

Now, let’s create a Bricks template. First, give your template a name. Then, set the template type to “Single.” This tells the system that this template will be used for individual blog posts.

Screenshot of a WordPress admin interface showing a post layout template titled "Bricks," with conditions for single post types and a shortcode. Published on 2023/07/10 at 5:44 am.

After creating the template, click on “Edit with Bricks.” Ensure that the template condition is set up properly so that it only shows for the intended posts.

Template settings for setting conditions on a website, including post type and archive post types, with options to add conditions or exclude.

Once you have everything set up, you can start designing your layout as you want. In this tutorial, we will focus on changing the blog heading layout, but you can also use this for a complete layout change.

We created three different sections and changed the labels for each one to match our template options in the backend, this helps you easily identify which section is which, making it simpler to manage your layout later on.

Screenshot of a web page editor showing a "Post Layout Template" with placeholders for dynamic data. Red arrows point to areas labeled "Dynamic data is empty" and the right panel displays template options.

Now that everything is set up, we need to use Bricks Display Conditions. This will allow us to show each layout based on the radio template options we created for posts. When the editor or admin selects one of these template options, the corresponding template will be displayed on the front end for that specific post.

setting up the conditions

This step is crucial for your templates to function as intended. To configure the conditions, first, click on the “Template 1” section. Then, look for the condition icon and click on it. This will allow you to set the rules for when this template will be displayed.

User interface of a design software showing a sidebar with options like layout, typography, background, and other styling tools. A red arrow points to an icon resembling two interlinked circles.

This will open the condition configuration panel. After that, click the “+” button to add a new condition. This is where you can set the rules for displaying the template.

A software interface displaying a template with conditions. It includes items like "Dynamic data" and "{acpt_post_post-layout-control_template}".
Template 1 condition
A computer screen showing a template with conditions, dynamic data, and layout controls for post management.
Template 2 Condition
Screenshot showing a Template 3 settings menu with conditions, featuring dynamic data, a layout control template, an equality condition, and Template 3 selected.
Template 3 Condition

After you’ve set all the rules correctly, go to your post page. From there, change the option to either Template 1, Template 2, or Template 3. Preview each one as you switch between them. If everything is set up correctly, they should all work just like shown in the video tutorial.

ACPT Version : 2.0.19

LogoCreated with Sketch.

Bricks Version : 1.11.1

If you haven't purchased ACPT yet and are planning to, we'd appreciate it if you use our affiliate link. It costs you nothing extra and helps us continue to deliver quality content. if you already have ACPT And this tutorial helped you Buy Me A Coffee