Template Conditions

What Are Template Conditions in Breakdance

In Breakdance, while templates allow you to design and layout your content, template conditions give you the power to specify precisely where those templates are applied. This level of specificity ensures that certain designs or layouts only show up in desired areas or under certain circumstances, making your website both dynamic and user-specific.

For instance, you might have a range of posts on your website, and you want a specific design or layout to only apply to a subset of those posts. Breakdance’s template conditions come into play here, letting you pinpoint exactly which posts get that design.

Using Template Conditions in Breakdance

Setting Up Basic Conditions

  1. Start by logging into your WordPress dashboard and navigate to Breakdance -> Templates.
  2. Choose to add a custom template and give it a suitable name. For this example, we’ll name it “Post”.
  3. Define that the template should apply to single posts.
  4. To refine its application, click Add Condition.
  5. Now, add a condition. For example, you could select the condition Post Is and then pick two specific posts. This ensures the template will apply only to these two posts.

Using Multiple Conditions with AND and OR

Adding an AND Condition

  1. With an AND condition, both conditions must be true for the template to apply. As an example, if you set conditions like “Post Is [specific post]” AND “User Login Status is Logged In”, the template will only appear for logged-in users viewing that exact post.
  2. To add an AND condition, click the AND button.

Adding an OR Condition

  1. The OR condition means that only one of the conditions needs to be true. You could combine conditions such as “Post Is [specific post]” OR “Author Is [specific author]”. This ensures the template will apply if either of those conditions holds true.
  2. To add an OR condition, click Add Condition.

Verifying Your Conditions

  1. After setting your conditions, visit the front end to check them.
  2. Inspect the posts or pages where the conditions should be in effect and confirm. Using the example above, the specific design should be visible only on the designated posts for logged-in users or if the post’s author matches the given condition.