Using conditions in Breakdance, you can create dynamic user experiences with intuitive logic. Whether you want to show a personalized message to logged-in users, display content based on a post type, or change layouts completely based on a custom field, conditions give you the ability to craft relevant, engaging, and adaptive designs. These conditions can be applied to templates, headers and footers, or to display elements.
Below is a summary of the included conditions in Breakdance and the operands available. You may also learn more about conditions via the following articles:
Furthermore, you can create custom conditions using the Conditions API
Default Conditions
Below are the default conditions included in Breakdance. Some conditions may only be available for templates when certain locations are set.
Singular
- Post – Select the Post(s) that will trigger the condition. Note: Separate conditions that perform the same functionality for Pages, Media, or other CPTs may be available.
- Post Parent – Select the Post Parent(s) to trigger the condition. Note: Separate conditions that perform the same functionality for Pages, Media, or other CPTs may be available.
- Has Taxonomy – Select the Taxonomy that triggers the condition when assigned to a Post.
- Post ID – Enter the specific ID of the Post to trigger the condition.
- Post Status – Select the Post Status(es) to trigger the condition.
- Comment Number – Enter the number of comments to trigger the condition.
- Author – Select the Author to define the condition.
- Featured Image – Determine if the Featured Image must be set or not for the condition.
- Post Type – Select the Post Type(s) that will trigger this condition. Note: Only available when Template Location is set to Single
Taxonomy
- Is Taxonomy – Determines the desired taxonomies and/or terms needed for the condition. Note: Only available when Template Location is set to All Archives, Specific Product Archive, or Taxonomy Archive.
Archive
- Author – Select the Author(s) to trigger the condition. Note: Only available when Template Location is set to Everywhere or is an Archive.
- Post Type – Select the Post Type(s) necessary for the condition. Note: Only available when Template Location is set to All Archives.
User
- User Logged In Status – Determine whether the user needs to be logged in or logged out.
- User Role – Select the User Role(s) needed to trigger the condition.
- User Registration Date – Select the User Registration Date needed to trigger the condition.
Other
- Search – Enter the search criteria necessary for the condition. Note: Only available when Template Location is set to Search Results.
- WP_Query Found Posts Count – Set the number of query results required to trigger the condition. Note: Only available when the Template Location is set to an Archive or Search Results.
- Dynamic Data – Select a Dynamic Data Point to use for the condition.
- Custom PHP – Use Custom PHP to determine how the condition returns true/false.
- Browser – Select the browser(s) to trigger the condition.
- Operating System – Select the operating system(s) to trigger the condition.
- Content Created With – Select whether or not the content needs to be created with Breakdance.
Date & Time
- Day of Week (WordPress) – Select the day(s) of the week to trigger the condition based on the WordPress site’s settings.
- Current Time (WordPress) – Select the time of day needed to trigger the condition based on the WordPress site’s settings.
- Current Date (WordPress) – Select the date needed to trigger the condition based on the WordPress site’s settings.
- Post Date – Select the publish date needed to trigger the condition.
- Post Modified Date – Select the modified date needed to trigger the condition.
- Current Month (WordPress) – Select the month(s) necessary to trigger the condition based on the WordPress site’s settings.
Referrer
- Referrer URL – Apply the condition based on the URL that the user previously visited from. Further Reading on Referrer URL (MDN).
- Referrer Type – Apply the condition depending on the type of referring source (e.g., search engine, direct link, social media).
Sessions
- Page View Count – The total number of page views for triggering the condition.
- Session Count – The total session count needed to trigger the condition.
WooCommerce Conditions
The WooCommerce conditions are available when the WooCommerce plugin is installed and activated.
Singular
- Product – Select the Product(s) that will trigger the condition. Note: Only available when Template Location is All Singles or Product).
- Product Parent – Select the Product Parent(s) to trigger the condition. Note: Only available when Template Location is All Singles or Product).
Cart
- Cart Quantity – Determine the Cart quantity needed to trigger the condition. Note: Only available as an Element condition.
- Cart Value ($) – Set the value of the Cart needed for the condition. Note: Only available as an Element condition.
- Cart Weight (kg) – Set the weight required in the cart for the condition. Note: Only available as an Element condition.
Customer
- Order Count – Determine how many orders a customer needs to trigger the condition. Note: Only available as an Element condition.
- Total Spend ($) – Set the total value spent by the customer for the condition. Note: Only available as an Element condition.
- Purchased Product – Set whether or not a specific product(s) must be purchased for the condition. Note: Only available as an Element condition.
Operands
Each Condition may have one or more operands available to them:
- contains – The item should contain the value set to return true.
- does not contain – The item should not contain the value set in order to return true.
- is – The condition will return true if it is the correct item(s).
- is after – The item value must be after the value set to return true.
- is all of – All selected items must be present for the condition to return true.
- is before – The item value must be before the value set to return true.
- is greater than – The item value must exceed the value set for the condition to return true.
- is lesser than – The item value must be less than the value set to have the condition return true.
- is not – The condition will return true if it is anything but the selected item(s).
- is one of – Any selected item must be present for the condition to return true.