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
Start by logging into your WordPress dashboard and navigate to Breakdance -> Templates.
Choose to add a custom template and give it a suitable name.
Define that the template should apply to single posts.
To refine its application, click Add Condition.
Now, add a condition.
Using Multiple Conditions with AND and OR
Adding an AND Condition
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.
To add an AND condition, click the AND button.
Adding an OR Condition
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.
To add an OR condition, click Add Condition.
Verifying Your Conditions
After setting your conditions, visit the front end to check them.
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.