In WooCommerce, My Category Listing page and product listing page are rendered from archieve-product.php ( By Default) . How to check if page is_shop() in functions.php? As is_shop function does not work in functions.php. I simply want to remove my sidebar from Category listing page not from product listing page.
WooCommerce Check If Product Page If you are looking for a way to check if you are on a product page in WooCommerce, you most likely think you should use WordPress single post conditional tag something like is_single( ).
3.1 Using the WordPress Settings To do so, navigate to Pages > All Pages from your WordPress dashboard. Find the 'Shop – Shop Page' and click the Edit button. You can then change your shop page title as shown below. Once done, click on the Update button to save your changes.
When placed inside a hook, is_shop
will work in functions.php
add_action( 'template_redirect', 'custom_template_redirect' );
function custom_template_redirect() {
if( is_shop() ) :
// code logic here
endif;
}
Here is a list of all WooCommerce conditionals
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With