New Feature: Earn 12 Badges

Bild

Collect up to 12 exclusive badges by sharing your plugin collections and engaging with the community.

See all Badges
WP Conditional Shortcodes
WP Conditional Shortcodes

by Tom Harrigan, John Leavitt

Description

This plugin gives content developers shortcode equivalents to the conditional tags that WordPress provides for theme developments. Each shortcode only includes its contents if a certain condition is true. This allows them to modify what content is shown in any given context on a post-by-post basis. is_page, is_single and is_category allow specific pages, posts, categories to be specified by using the “ids” parameter.

The shortcodes and when they include contents are:

  • is_single – if showing a single post. Use the optional parameter “ids” to specify specific posts.
  • is_singular – if showing a single post or page.
  • is_page – if showing a page. Use the optional parameter “ids” to specify specific pages.
  • is_home – if showing the blog home.
  • is_front_page – if showing the front page of the site.
  • is_sticky – if the current post or page is ‘sticky’.
  • is_category – if showing a category-based archive. Use the optional parameter “ids” to specify specific categories.
  • is_page – if showing a page.
  • is_tag – if showing a tag-based archive.
  • is_tax – if showing a tag- or category-based archive.
  • is_author – if showing an author-based archive.
  • is_archive – if showing any archive.
  • is_year – if showing a yearly archive.
  • is_month – if showing a monthly archive.
  • is_day – if showing a daily archive.
  • is_time – if showing an hourly or shorter archive.
  • is_feed – if generating a feed.
  • is_search – if showing search results.
  • comments_open – if comments are open for the current post or page.

Each shortcode also has an “else” shortcode that can go inside it. For example:

[is_single]
This is only shown if showing just this post.
[not_single]
This is shown everywhere else.
[/is_single]

The is_page, is_category and is_single shortcodes allow you to specify pages, categories, posts on which to show the content if you’d like to only show content within the shortcode on specific pages, posts or categories.

[is_page ids="76, 339"]hello[/is_page]

[is_category ids="5, 7"]hello[/is_page]

[is_single ids="94, 63"]hello[/is_single]

In general, the “else” shortcode is just replacing “is” with “not”. The one exception is “not_comments_open” as the “else” shortcode for “comments_open”.

Whichever chunk of content is included is processed for shortcodes, so you can use all your other shortcodes and even nest these if you need to.

Further Instructions

Any other information I have can be found at the WP Conditional Shortcodes Homepage.

All texts and images on this product page are protected by copyright and are the property of the author Tom Harrigan, John Leavitt. You will be redirected to the retailer to download the plugin. We act solely as a search engine for plugins and are not affiliated with the retailer or Tom Harrigan, John Leavitt.

Tags

Free Plugin

5.0
4 Reviews
Last Update
13 years ago
Installations
50
All trademarks, logos and brand names are the property of their respective owners. All company, product and service names used in this website are for identification purposes only. The WordPress® trademark is the intellectual property of the WordPress Foundation

Collections

SEO Plugins

  • 6 Plugins
  • 5 Views
Yoast SEO
All in One SEO – Powerful SEO Plugin to Boost SEO Rankings & Increase Traffic
Rank Math SEO – AI SEO Tools to Dominate SEO Rankings
WP Fastest Cache

Page Builder

  • 1 Plugin
  • 11 Views
Page Builder: Pagelayer – Drag and Drop website builder

payment methodes per

  • 1 Plugin
  • 5 Views
Payment Gateway Based Fees and Discounts for WooCommerce

SEO

  • 1 Plugin
  • 5 Views
Yoast SEO

Wordpress

  • 13 Plugins
  • 7 Views
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL)
Forminator Forms – Contact Form, Payment Form & Custom Form Builder
Yoast SEO
Site Kit by Google – Analytics, Search Console, AdSense, Speed

slider

  • 1 Plugin
  • 5 Views
Photo Gallery, Sliders, Proofing and Themes – NextGEN Gallery

Yeer

  • 1 Plugin
  • 6 Views
Autoptimize

Optimisation Plugins

  • 1 Plugin
  • 12 Views
Smush Image Optimization – Optimize Images | Compress & Lazy Load Images | Convert WebP | Image CDN

Best Speed Plugins

  • 4 Plugins
  • 6 Views
LiteSpeed Cache
WP Fastest Cache
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance
10Web Booster – Website speed optimization, Cache & Page Speed optimizer

Must-Have Plugins

  • 9 Plugins
  • 115 Views
Elementor Website Builder – More than Just a Page Builder
Yoast SEO
All-in-One WP Migration and Backup
Wordfence Security – Firewall, Malware Scan, and Login Security

Best Security Plugins

  • 3 Plugins
  • 5 Views
Jetpack – WP Security, Backup, Speed, & Growth
Wordfence Security – Firewall, Malware Scan, and Login Security
Solid Security – Password, Two Factor Authentication, and Brute Force Protection

Best Member Plugins

  • 5 Plugins
  • 6 Views
Paid Memberships Pro – Content Restriction, User Registration, & Paid Subscriptions
Ultimate Membership Pro - WordPress Membership Plugin
Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress

Best Recruitment Website Plugins

  • 3 Plugins
  • 6 Views
WP Job Openings – Job Listing, Career Page and Recruitment Plugin
Smush Image Optimization – Optimize Images | Compress & Lazy Load Images | Convert WebP | Image CDN
WP Job Manager

Cookie Plugins

  • 3 Plugins
  • 14 Views
CookieYes – Cookie Banner for Cookie Consent (Easy to setup GDPR/CCPA Compliant Cookie Notice)
Autoptimize
Complianz – GDPR/CCPA Cookie Consent

Donation Plugins

  • 2 Plugins
  • 25 Views
Charitable – Donation Plugin for WordPress – Fundraising with Recurring Donations & More
GiveWP – Donation Plugin and Fundraising Platform