Conditional Content shortcodes are handy in widgets that are applied globally but you only wish for a portion of the content in the widget to display on a specific area of the site.
Display only on specific post types
[if_posttype parameters] Content [/if_posttype]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | Post type to include | yes | page, post, location, team, testimonial |
Display if not post types
[if_not_posttype parameters] Content [/if_not_posttype]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | Post type to include | yes | page, post, location, team, testimonial |
Display only on front/homepage
[if_home] This content will only on the homepage. [/if_home]
Display only if not on front/homepage
[if_not_home] This content will only display if not currently viewing the homepage. [/if_not_home]
Display only on specified post ID
[if_post parameters] Content [/if_post]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | ID # of post | yes | any WordPress post ID | |
| exclude | Comma separated list of post IDs to exclude | no | any WordPress post ID |
Display only if NOT on specified post ID
[if_not_post parameters] Content [/if_not_post]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | ID # of post | yes | any WordPress post ID |
Display only on specified page ID
[if_page parameters] Content [/if_page]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | ID # of page | yes | any WordPress page ID | |
| exclude | Comma separated list of page IDs to exclude | no | any WordPress page ID |
Display only if NOT on specified page ID
[if_not_page parameters] Content [/if_not_page]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | ID # of page | yes | any WordPress page ID |
Display only on specified section
A section is defined as a page and all childpages that fall under that page.
[if_section parameters] Content [/if_section]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | ID # of page | yes | any WordPress page ID | |
| exclude | Comma separated list of page IDs to exclude | no | any WordPress page ID |
Display only if NOT on specified section
[if_not_section parameters] Content [/if_not_section]
Parameters
| Parameter | Description | Required | Values | Default |
|---|---|---|---|---|
| id | ID # of page | yes | any WordPress page ID |
