Understanding Conditional Layouts

11/02/2020

A Conditional Layout is simply a way to make a Layout that only applies to certain pages, or conditions. In this way, you can have multiple layouts for different post types or categories, or whatever your design needs are.

By default, there is the Global Layout in the Theme Builder, which you can use to add global custom Layout Sections to. But you can also create as many other Layouts as you like, and then set conditions for when that Layout will be used. Conditions are largely based on custom post types, and there are many conditions for each type. For example, you might want a layout that is only active on Single Post Pages, or Single Portfolio items, or Event Calender Items etc. But conditions can be as complex as you want, and you can use both multiple conditions, and multiple exceptions. This is a very powerful system, which can create Custom Layouts for virtiualy any aspect of your site. Let’s look at the Layout Conditions dialog to see what can be done with this amazing tool.

As seen below, it’s is split up into three columns, the first one being broken up into the Custom Post Types available on your installation. If you select a Post Type, the middle column is then populated with all possible conditions for that post type. For each condition, there is a tick box and a cross box. Use the tick box to include a condition, and the cross box to exclude a condition. Selected conditions are then shown in the third column, for a simple overview of the conditions chosen for the layout.

Layout Conditions

Examples

Rather than go through every single condition, let’s show a few examples of how the Layout Conditions might be used. The possibilities are almost endless and depend entirely on your situation, but once you understand how the conditions work, you will easily be able to apply them to your specific site and situation.

Custom 404 Page

A Custom 404 page is now very easy to create. Simply make a new Layout, and in the conditions, assign it to Other > Custom 404 page. Then, using a Content Layout Section, you can design whatever 404 page you like, with any content and design, using the full power of the Fusion Builder.

404 Page Layout Conditions

Custom Single Posts Layout

The next example, is a Custom Single Posts Layout with an exclusion. As you can see from the Layout Conditions below, this Layout would be shown on ALL posts, with the exception of posts in The Designer Show Category. For this category, the default single posts layout would load, unless you created a custom layout for just that category.

Custom Single Posts Layout With Exclusions

Custom Post Category Pages

In this example, the Layout conditions have been set to only show the Layout on certain Post Categories, in this case, Business and Business Broadcast. This might be, for example, if you wanted a Custom Advertising Banner above or below your normal Post Content for only these two Categories.

Post Category Layout Conditions