Using Conditionals
When the conditional is published you will have three ways to reference the conditional so that it can be used to personalize, segment and control dynamic content throughout your site.
1. Conditional Title
You would use the conditional title to reference the conditional when using any of the supported page builders or WordPress menus and widgets.
This would allow you to control the display of the following based upon the evaluation of the conditional:
- Beaver Builder - Modules, Columns & Rows
- Elementor - Widgets, Sections & Popups
- Block Editor (Gutenberg) - Blocks
- Oxygen Builder - Elements
- WordPress - Menu Items
- WordPress - Widgets (Pre WordPress 5.8)
For detailed instructions on how to use a conditional with any of the above follow the appropriate links below:
- Set Beaver Builder module/column/row visibility based upon a conditional
- Set Beaver Builder module/column/row visibility using Beaver Themer Conditional Logic based upon a conditional
- Set Beaver Themer Layout rules based upon a conditional
- Set Elementor Widget/Container/Section display based upon a conditional
- Set Elementor popup display based upon a conditional
- Set Block Editor block display based upon a conditional
- Set ActiveMember360 conditions to show/hide Oxygen Builder elements based upon a conditional
- Menu item display conditional mode
- Widget display conditional mode
When the conditional is used in this way it controls the display of the entire item, whether it be; Beaver Builder Modules, Columns & Rows, Elementor Widgets, Sections & Popups, Gutenberg Blocks, Oxygen Elements, WordPress Menus or WordPress Widgets.
This method can only be used with the page builders that ActiveMember360 provides an full integration with by way of an ActiveMember360 Extension and with WordPress menus and widgets.
Draft/trashed/deactivated/inactive conditionals will always return TRUE.
2. Conditional Shortcode
You would use the conditional shortcode to reference the conditional anywhere that supports the use of shortcodes or if the conditional title reference method was not supported or appropriate.
This allows you to control what content is seen in:
- Post titles
- Post/page content
- Post/page excerpts
- Widgets
- Menus
- …and many custom post types such as:
- LearnDash courses, lessons,topics and quizzes.
- WooCommere product pages.
- …and page builders that support shortcodes such as:
- Thrive Architect
- Divi
- OptimizePress
- etc.
Otherwise the difference between using the conditional shortcode and conditional title is that the shortcode allows you to segment and personalize content within an item.
As an example the title method allows you to control the display of an entire Gutenberg text block but the shortcode method allows you to control the content within the block.
The shortcode is used in the same way as any WordPress/ActiveMember360 shortcode.
So if the following was placed in the post content:
[mbr_is_conditional id='6588']
Show this content when the condition is TRUE
[ELSE_is_conditional]
Show this content when the condition is FALSE
[/mbr_is_conditional]
"Show this content when the condition is TRUE" is shown when the conditional with id 6588 evaluates to true and "Show this content when the condition is FALSE" is shown when the conditional with id 6588 evaluates to false.
In the majority of cases we would expect the conditional to be referenced by the title method rather than the shortcode method.
The mbr_is_conditional shortcodes can be nested up to nineteen levels deep.
For full details of the shortcode please visit the following article mbr_is_conditional.
If draft/trashed/deactivated/inactive conditionals are specified using the shortcode nothing will be displayed as the shortcode will not be evaluated.
3. PHP API Method
This is for use by developers and/or those wishing to use the conditional within PHP code.
It provides a conditional function that can be used with an IF/ELSE construct.
mbr_is_conditional( id )
where id is an integer and the post_id of the conditional custom post.
This method is useful for those wishing to modify theme templates or similar.