Skip to main content

i4w_ifpost

Usage

This shortcode is designed to check for the existence of a $_POST variable 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_ifpost] conditional branching is supported.

Shortcode nesting is supported: [i4w_ifpost1] thru [i4w_ifpost19] and [ELSE_ifpost1] thru [ELSE_ifpost19]

Parameters

ParameterDescriptionDefaultRequired
postThe name of the $_POST variable for whose existence you are checking.NoneYes
valA value which the $_POST variable must hold in order for the shortcode to evaluate to true.NoneNo

Example

Will display "Test POST is set" if $_POST['test_post'] exists:

Shortcode
[i4w_ifpost post='test_post']
Test POST is set
[ELSE_ifpost]
Test POST is NOT set
[/i4w_ifpost]

Will display "Test POST is set to 123" if $_POST['test_post'] exists AND its value is 123:

Shortcode
[i4w_ifpost post='test_post' val=123]
Test POST is set to 123
[ELSE_ifpost]
Test POST is NOT set to 123
[/i4w_ifpost]