Chap
Show

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].
Classes
AMPamp-only amp-invisible
operatorOperator between multiple arguments [OR|AND|NOT] (default: OR).
Button shown only on front page
[show on="front"]
  [button]Button[/button]
[/show]
Button shown anywhere but front page
[show on="front" operator="NOT"]
  [button]Button[/button]
[/show]
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]
[/show]
Button shown only on posts with post_type "post"
[show post_type="post"]
  [button]Button[/button]
[/show]
Button shown only on posts in "Shortcodes" category
[show category="Shortcodes"]
  [button]Button[/button]
[/show]
Button shown only on posts that have "test" tag
[show tag="test"]
  [button]Button[/button]
[/show]
Segment shown only on posts that are created by "websevendev"
[show author="websevendev"]
  [segment]
    [header]
      [subheader]Author[/subheader]
      websevendev
    [/header]
  [/segment]
[/show]
Button shown only on single posts with the "show" slug
[show single="show"]
  [button]Button[/button]
[/show]
Button shown only on pages that are titled "About"
[show page="About"]
  [button]Button[/button]
[/show]
Button shown only page that has "/contact" path
[show path="/contact"]
  [button]Button[/button]
[/show]
Button shown based on logged in status
[show when="logged-in"]
  [button]Log out[/button]
[/show]
[show when="logged-out"]
  [button]Log in[/button]
[/show]
Button shown based on current locale
[show locale="en_US"]
  [button]Hello[/button]
[/show]
[show locale="en_AU"]
  [button]G'day[/button]
[/show]
Button shown only at "order-received" and "view-order" WooCommerce endpoints
[show wc_endpoint="order-received, view-order"]
  [button]Button[/button]
[/show]
Button shown on any page with WooCommerce content
[show on="wc"]
  [button]Button[/button]
[/show]
Exit mobile version