This page give how-to instructions for creating, deleting and modifying conditional elements. For an introduction to this relatively advanced topic, read About Conditional Elements before proceeding.
The Content and Conditions of Elements
Building and editing the content of a conditional element is similar to authoring any ordinary page. The power of conditional elements comes from the flexibility in where you can place them in webpages and the conditions that control whether they appear or not. The content of such a conditional element is fixed; the element settings control whether users see it based on factors such as:
- Which pages the element appear on.
- Where within those pages the element appears.
- Which users can see it, based on user roles.
- What kinds of devices (large screen or mobile) can display the element.
- The dates and times when the element is visible.
A requirement that you might expect to require a programmer to code using if … then … else logic, can often be solved with a conditional element. The conditional code is executed when by the Kadence process that links to webpages, not within those webpages. Read what goes into an element in the Kadence Knowledge base for more detail of the element settings.
Working with Conditional Elements
To access conditional elements from the WordPress Dashboard, open the Appearance menu and select Elements. A panel that opens in which all elements currently are listed. At the time of the writing, three elements appear.
Table of Element Settings
These settings give you the power to add conditional behaviour to a website without writing code. The examples column explains the effect of the setting on the conditional elements in the LLIR website.
| Setting Name | Description | Example/Comment |
|---|---|---|
| Element type | Should be Content Section | All existing elements are Content Sections. |
| Preview settings | The default is usually appropriate for pages. These settings usually apply to websites composed of posts rather than pages. | |
| Placement | This dropdown list shows where you can position the element within a pages. The most common placements are below the page header or before the footer. | The Developer Notes element appears above the page footer. The content of the Member Only Page (the Please Log In message follows the page header. |
| Priority | The default is usually adequate. If elements and their settings produce conflicts, element priorities determine which element’s conditions apply first. | |
| Display Settings | This expandable set of options controls which pages the element appears on. You can specify pages by category or select pages individually, You can also exclude specific pages. | The Waitlist Open element can appears only on the Waitlist Process page. The Member Only Page element is excluded from pages in the public area of the website. |
| User Settings | Expand this option to see a dropdown list from which you can select the category of user who can see this element (typically by user role or whether logged in). | Only WordPress administrators see the Developer Notes element. Users who are not logged in see the Member Only Page element. |
| Device Settings | Expand this option to see a dropdown list from which you can select that element appears only on Desktop (relatively large) screens or Mobile (smartphones and small) screens. | The Developer Notes element appears only on relatively large screens. |
| Expiration | Expand this option and set Enable Expires for elements that appear only at specific times. Then you can set the expiry date and time (in the Toronto time-zone). | Whether the WaitList Open element is visible when it’s expiry date is in the future. |
Warning
The power and flexibility of conditional elements comes with the potential of complicating the logic required to combine elements and element settings to get the intended results. If you add more conditional elements, think carefully through all possible combinations that may apply to the same pages.
