The [show] shortcode can be used to conditionally show contents only on certain pages.

It can be useful when adding content to global locations, such as widget areas, "before header content", "after page content", "before footer content", etc.

In template files the shortcode can be called using <?php echo do_shortcode('[show on="blog"] ... [/show]'); ?>.

Show shortcode arguments
onMatch keyword [home|front|blog|singular|sticky|archive|search|rtl|404|wc|shop|cart|checkout|account].
post_typeMatch post type [post|page|product|...].
categoryMatch a category name, slug or ID.
tagMatch current post tags.
taxMatch current taxonomy.
authorMatch an author name, slug or ID.
singleMatch a single post of any post type by name, slug or ID.
pageMatch a page by name, slug or ID.
pathMatch a path.
whenMatch state [logged-in|logged-out].
localeShow content only if current locale matches the specified locale (case-insensitive) [en_US|en_GB|de_DE...].
wc_endpointMatch a WooCommerce endpoint slug [order-pay|order-received|view-order|edit-account|edit-address|lost-password|customer-logout|add-payment-method].
AMPamp-only amp-invisible
operatorOperator between multiple arguments [OR|AND|NOT] (default: OR).
Button shown only on front page
[show on="front"]
Button shown anywhere but front page
[show on="front" operator="NOT"]
Message shown only on Cart or Checkout page
[show on="cart, checkout"]
  [message info][icon info]Use Coupon SUMMER2018 for 10% off on all orders.[/message]
Button shown only on posts with post_type "post"
[show post_type="post"]
Button shown only on posts in "Shortcodes" category
[show category="Shortcodes"]
Button shown only on posts that have "test" tag
[show tag="test"]
Segment shown only on posts that are created by "websevendev"
[show author="websevendev"]
Button shown only on single posts with the "show" slug
[show single="show"]
Button shown only on pages that are titled "About"
[show page="About"]
Button shown only page that has "/contact" path
[show path="/contact"]
Button shown based on logged in status
[show when="logged-in"]
  [button]Log out[/button]
[show when="logged-out"]
  [button]Log in[/button]
Button shown based on current locale
[show locale="en_US"]
[show locale="en_AU"]
Button shown only at "order-received" and "view-order" WooCommerce endpoints
[show wc_endpoint="order-received, view-order"]
Button shown on any page with WooCommerce content
[show on="wc"]
Exit mobile version