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
on:
Match heyword [home|front|blog|singular|sticky|archive|search|rtl|404|wc|shop|cart|checkout|account].
post_type:
Match post type [post|page|product|...].
category:
Match a category name, slug or ID.
tag:
Match current post tags.
tax:
Match current taxonomy.
author:
Match an author name, slug or ID.
single:
Match a single post of any post type by name, slug or ID.
page:
Match a page by name, slug or ID.
path:
Match a path.
wc_endpoint:
Match a WooCommerce endpoint slug [order-pay|order-received|view-order|edit-account|edit-address|lost-password|customer-logout|add-payment-method].
classes:
AMP -
[amp-only|amp-invisible]
operator:
Operator 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 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>

One response to “Show

Leave a reply to Author info box, navigation – version 1.13.8 – Chap Cancel reply

Your email address will not be published. Required fields are marked *