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.
Leave a Reply
You must be logged in to post a comment.
When placed inside a hook,
is_shop
will work in functions.phpHere is a list of all WooCommerce conditionals
You can write a condition into “archive-product.php” for category page like,
By using this code this will check the page for product_category and also check for a parent.
call it using WordPress Hook pre get posts
Read more about pre get posts Hook
https://developer.wordpress.org/reference/hooks/pre_get_posts/
You can use
function_exists
Official docs: https://secure.php.net/function_exists