mbr_is_conditional
Usage
This shortcode determines the content to be included based upon the evaluation of a conditional.
The purpose, definition, and use of conditionals is explained in detail here:
Parameters
Parameters | Description |
---|---|
field | The conditional id to be evaluated. Default: none. Required: yes. |
To ensure compatibility with the various page builders we recommend that no quote delimiters are used to specify the id parameter.
Quotes are not needed for this shortcode as there can never be any spaces in the id.
Validity
This shortcode is evaluated for any type of visitor.
Please be aware that if the conditional specified by the id is not published/active this shortcode will not be evaluated and will not display/include any content.
Conditional Branching
[ELSE_is_conditional] conditional branching is supported.
Nesting
Shortcode nesting is supported:
[mbr_is_conditional1] thru [mbr_is_conditional19]
[ELSE_is_conditional1] thru [ELSE_is_conditional19]
[/mbr_is_conditional1] thru [/mbr_is_conditional19]
Examples
- Example 1
- Example 2
- Example 3
- Example 4
Display "Message 1" if the conditional with id 123 evaluates to TRUE:
[mbr_is_conditional id=123]
Message 1
[/mbr_is_conditional]
Display "Message 1" if the conditional with id 123 evaluates to TRUE. Otherwise display "Message 2":
[mbr_is_conditional id=123]
Message 1
[ELSE_is_conditional]
Message 2
[/mbr_is_conditional]
Display in this order of priority "Message 1" if the conditional with id 123 evaluates to TRUE. Else display "Message 2" if the conditional with id 456 evaluates to TRUE. Else display "Message 3" if the conditional with id 456 evaluates to FALSE. Else display "Message 4" if the conditional with id 123 evaluates to FALSE.
[mbr_is_conditional id=123]
Message 1
[mbr_is_conditional1 id=456]
Message 2
[ELSE_is_conditional1]
Message 3
[/mbr_is_conditional1]
[ELSE_is_conditional]
Message 4
[/mbr_is_conditional]
Display in this order of priority "Message 1" if the conditional with id 123 evaluates to TRUE. Else display "Message 2" if the conditional with id 456 evaluates to TRUE. Else display "Message 3" if the conditional with id 123 evaluates to FALSE.
[mbr_is_conditional1 id=123]
Message 1
[mbr_is_conditional2 id=456]
Message 2
[/mbr_is_conditional2]
[ELSE_is_conditional1]
Message 3
[/mbr_is_conditional1]
API
The PHP API function equivalent for this shortcode is:
mbr_is_conditional( id )
where id is an integer and the post_id of the conditional custom post.