[ show_if]content[/show_if], [ hide_if]content [/hide_if]
[ show_if] and
[ hide_if] shortcodes allow you to selectively display or hide content depending if any of several conditions are met.
[ hide_if device=device logged_in=true/false not_post_id=id-list post_id=id-list user_can=what]
You bracket the content you want to selectively display with
[ show/hide_if] and closing
[/show/hide_if] tags. That content can contain other shortcodes as needed. If you specify more than one parameter to the short code, then all the conditions must be met (logical AND). Any parameters you don’t include are not used in the logic.
‘device’ => ‘default’, // desktop, mobile, smalltablet, phone, all
‘logged_in’ => ‘default’, // true or false
‘not_post_id’ => ‘default’, // comma separated list of post IDs (includes pages, too)
‘post_id’ => ‘default’, // comma separated list
‘user_can’ => ‘default’ // http://codex.wordpress.org/Function_Reference/current_user_can
device=desktop | mobile | smalltablet | phone – The device parameter for
[show/hide_if] is designed to allow you to hide or show any content on any of the device sizes recognized by Weaver Xtreme (or any theme, actually): ‘phone’, ‘smalltablet’, and ‘desktop’, or ‘mobile’ for non-desktop devices. If you want to show or hide content on a specific device, you give the device parameter a value of desktop, mobile, smalltablet, phone, or none (e.g.,
[ show_if device=mobile]).
logged_in=true | false – This will hide or display content depending if the visitor is logged into the site or not.
post_id=34,875 / not_post_id=1,2,3 – This will display (or not display) the content depending if the current page or single post view is included in the comma separated list of WordPress page/post IDs. You can use both to refine a list of pages or posts to display or not display. Note that even though the parameter is called ‘post_id’, it applies equally to pages and posts. Depending on where you use the shortcode, it will apply to a post differently depending if it is on a blog or single page view of a post. Note that the default WordPress blog (as opposed to the Weaver Xtreme Page with Posts template) does not have a post_ID.
user_can=user-capability – This will show or hide depending if the current visitor has certain WordPress user capabilities. There are many capabilities which are defined in the WordPress Codex. This shortcode supports any of the listed capabilities for maximum flexibility. If you don’t want to learn about all the capabilities listed in the Codex, you can use the following capability values to determine if the visitor has a specific role (as defined on the Dashboard Users admin pages). For example:
[ show_if user_can=publish_pages]content for Editors and above[/show_if]
Note that the higher roles have all the capabilities of the lower roles – an Editor can do everything a Contributor can.
|Super Administrator (MultiSite)||manage_network|