CS If Shortcode

Description

WordPress shortcode allows blocks of content to be conditionally included or excluded based on shortcode parameters.

Syntax

[cs_if parameters]Your content here.[/cs_if]

where parameters includes:

Name Values Notes
is_user_logged_in none True if a user is logged in to the site.
is_daylight_saving_time none True if the server says DST is on in its local time zone.
username Any valid username True if the current username matches the one specified.
current_user_can WordPress capability / role True if the current user has the specified capability / role. See WordPress documentation for current_user_can for more details.
conjunction and | or Can be used to create compound conditions.
not none If present, negates the rest of the condition after evaluation.

 

Examples

[cs_if is_daylight_saving_time]
<p>Daylight Saving Time is ON! (default)</p>
[/cs_if]

[cs_if not is_daylight_saving_time]
<p>Daylight Saving Time is NOT ON!</p>
[/cs_if]

[cs_if is_daylight_saving_time="false"]
<p>Daylight Saving Time is OFF!</p> 
[/cs_if]