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:
Conditionals
Parameters:
id | 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:
[i4w_is_conditional1] thru [i4w_is_conditional19]
[ELSE_is_conditional1] thru [ELSE_is_conditional19]
[/_is_conditional1] thru [/_is_conditional19]
Examples:
- Display “Message 1” if the conditional with id 123 evaluates to TRUE:
[i4w_is_conditional id=123] Message 1 [/i4w_is_conditional]
- Display “Message 1” if the conditional with id 123 evaluates to TRUE. Otherwise display “Message 2”:
[i4w_is_conditional id=123] Message 1 [ELSE_is_conditional] Message 2 [/i4w_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.
[i4w_is_conditional id=123] Message 1 [i4w_is_conditional1 id=456] Message 2 [ELSE_is_conditional1] Message 3 [/i4w_is_conditional1] [ELSE_is_conditional] Message 4 [/i4w_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.
[i4w_is_conditional1 id=123] Message 1 [i4w_is_conditional2 id=456] Message 2 [/i4w_is_conditional2] [ELSE_is_conditional1] Message 3 [/i4w_is_conditional1]
API:
The PHP API function equivalent for this shortcode is:
i4w_is_conditional( id )
where id is an integer and the post_id of the conditional custom post.