Skip to content

Instantly share code, notes, and snippets.

@alicolville
Last active June 25, 2019 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alicolville/2e61c83fc72b990878c55affa05e6d09 to your computer and use it in GitHub Desktop.
Save alicolville/2e61c83fc72b990878c55affa05e6d09 to your computer and use it in GitHub Desktop.
Sample
<!-- -------------------------------------------------- -->
<!-- Firstname and Last name examples -->
<!-- -------------------------------------------------- -->
[cs-if conditions="firstname"]
First name exists
[/cs-if]
[cs-if conditions="firstname" operator="not-exists"]
First name does not exist
[/cs-if]
[cs-if conditions="firstname" operator="equals" compare-value="YeKen"]
First name equals YeKen
[/cs-if]
[cs-if conditions="firstname,lastname" operator="not-exists"]
First and last name do not exist
[/cs-if]
[cs-if conditions="firstname,lastname"]
First and last name exist
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- Display Name -->
<!-- -------------------------------------------------- -->
[cs-if conditions="display-name" operator="equals" compare-value="yeken"]
Display name equals YeKen
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- Logged In Status -->
<!-- -------------------------------------------------- -->
[cs-if]
User logged in (default)
[/cs-if]
[cs-if compare-value="false"]
User not logged ( set to false )
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- Nested IF with ELSE conditions -->
<!-- -------------------------------------------------- -->
[cs-if conditions="is-logged-in"]
<p>The user is logged in.</p>
[cs-if-1 conditions="firstname"]
The user has entered a first name!
[else-1]
The user must enter a first name!
[/cs-if-1]
[cs-if-1 conditions="lastname"]
The user has entered a last name!
[else-1]
The user must enter a last name!
[/cs-if-1]
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- IP Address -->
<!-- -------------------------------------------------- -->
[cs-if conditions="ip" operator="equals" compare-value="192.168.10.1"]
The user's IP address is: 192.168.10.1
[cs-if-1]
The user is logged in though!
[else-1]
The user is not logged in!
[/cs-if-1]
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- User ID -->
<!-- -------------------------------------------------- -->
[cs-if conditions="user-id" operator="equals" compare-value="1"]
The user's ID is: 1
[else]
The user's ID is greater than 1.
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- Post ID -->
<!-- -------------------------------------------------- -->
[cs-if conditions="post-id" operator="equals" compare-value="9"]
The current Post ID is: 9
[else]
The Post ID is not 9.
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- Post Slug -->
<!-- -------------------------------------------------- -->
[cs-if conditions="post-slug" operator="equals" compare-value="test"]
The current post's slug is "test"
[else]
The current post's slug is not "test"
[/cs-if]
<!-- -------------------------------------------------- -->
<!-- Post Type -->
<!-- -------------------------------------------------- -->
[cs-if conditions="post-type" operator="equals" compare-value="page"]
Post Type is PAGE
[else]
[cs-if-1 conditions="post-type" operator="equals" compare-value="post"]
Post Type is POST
[else-1]
Post type is not PAGE or POST.
[/cs-if-1]
[/cs-if]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment