i4w_ifcookie
This shortcode is designed to check for the existence of a cookie and, given a value to check, for a value match. Any content embedded between the tags will be displayed if the criteria is met.
[ELSE_ifcookie] conditional branching is supported.
Shortcode nesting is supported: [i4w_ifcookie1] thru [i4w_ifcookie19] and [ELSE_ifcookie1] thru [ELSE_ifcookie19]
Parameters
Section titled “Parameters”| Parameter | Description | Default | Required |
|---|---|---|---|
| cookie | The name of the cookie for whose existence you are checking. | None | Yes |
| val | A value which the cookie must hold in order for the shortcode to evaluate to true. | None | No |
Example
Section titled “Example”Will display “Test Cookie is set” if a cookie by the name of “test_cookie” exists, without checking the value:
[i4w_ifcookie cookie='test_cookie'] Test Cookie is set[ELSE_ifcookie] Test Cookie is NOT set[/i4w_ifcookie]Will display “Test Cookie is set to 123” if a cookie by the name of “test_cookie” exists AND its value is 123:
[i4w_ifcookie cookie='test_cookie' val=123] Test Cookie is set to 123[ELSE_ifcookie] Test Cookie is NOT set to 123[/i4w_ifcookie]