All conditional tags test whether a condition is met, and then return either TRUE or FALSE.

WooCommerce page

is_woocommerce()

Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).

Main shop page

is_shop()

Returns true when on the product archive page (shop).

Product category page

is_product_category()

Returns true when viewing a product category archive.

is_product_category( 'shirts' )

When the product category page for the ‘shirts’ category is being displayed.

is_product_category( array( 'shirts', 'games' ) )

When the product category page for the ‘shirts’ or ‘games’ category is being displayed.

Product tag page

is_product_tag()

Returns true when viewing a product tag archive

is_product_tag( 'shirts' )

When the product tag page for the ‘shirts’ tag is being displayed.

is_product_tag( array( 'shirts', 'games' ) )

When the product tag page for the ‘shirts’ or ‘games’ tags is being displayed.

Single product page

is_product()

Returns true on a single product page. Wrapper for is_singular.

Cart page

is_cart()

Returns true on the cart page.

Checkout page

is_checkout()

Returns true on the checkout page.

Customer account pages

is_account_page()

Returns true on the customer’s account pages.

Ajax request

is_ajax()

Returns true when the page is loaded via ajax.

Leave a Reply

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