« Back to Knowledge Base

How to use the conditional tags option.

16 views Plugins

The Condition tags option was built to allow you to select which page where will the pop-up appear. This feature is available on multiple plugins like WooCommerce Notification, WooCommerce Multi Currency, WooCommerce Lucky Wheel, WordPress Lucky Wheel. In this guide, I will try to show you some simple & common Conditional tags.

To learn more about how conditional tags work, please refer to the official guides:

Below are some of the most commonly used conditional tags supported by this plugin.

Important note: 

To safely handle WordPress Conditional Tags, this plugin restricts the allowed conditions to a predefined whitelist only. Instead of permitting arbitrary PHP execution, only the following validated and supported conditional tags can be used:

'is_home',
'is_front_page',
'is_single',
'is_page',
'is_attachment',
'is_singular',
'is_archive',
'is_category',
'is_tag',
'is_author',
'is_date',
'is_year',
'is_month',
'is_day',
'is_search',
'is_404',
'is_post_type_archive',
'is_admin',
'is_user_logged_in',
'is_active_sidebar',
'is_woocommerce',
'is_shop',
'is_product',
'is_product_category',
'is_product_tag',
'is_product_taxonomy',
'is_account_page',
'is_cart',
'is_checkout',
'is_order_received_page',

Displaying on Homepage

is_home()

or

is_front_page()

On some websites, the front page is not the home page, so you may try both 2 codes above. To not display on the homepage, please add an exclamation mark before the code

!is_home()

!is_front_page()

Displaying on WooCommerce pages.

WooCommerce pages include single product pages, the Shop page, and categories. But not the Cart page and Checkout page, cart and checkout are standard pages. To display pop-ups on WooCommerce.

is_woocommerce()

Displaying on Cart & Check out pages.

is_cart()

is_checkout()

Displaying on specific pages. 

To display on some specific pages, you need the ID of that pages.

When Post 17 is being displayed as a single Post.

is_page( '17' )

Returns true when the single post being displayed is either post ID = 17, post ID = 19, post ID = 1 or post ID = 11.

is_page( array( 17, 19, 1, 11 ) )

To get the ID of a page, you need to go to the edit page of that page. The ID will appear in the URL of the page.

Some common conditional tags. 

These are some common conditional tags we often give to the web owner

is_home() || is_front_page() || is_woocommerce()

Displaying on homepage and WooCommerce pages.

is_woocommerce() || is_cart()

Displaying on Woocommerce pages and Cart page.

is_woocommerce() || is_cart() || is_checkout()

Displaying on WooCommerce pages, Cart page, and Checkout page