I'm trying to use is_category in woocommerce.php
which is not working. I want to print the title according the page.
IF a page is category page then will print woocommerce_page_title()
and if a page is product then should print the_title()
.
And the code I am using in woocommerce.php
is:
<?php if(is_category()){ ?>
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
<?php }
else{
the_title();
}
?>
But in every case it is printing the_title()
. I think is_category()
is not working for woocommerce.
Or Can any one tell how woocommerce do it to print category and product title?
Any help will be appreciated.
you should use
is_product_category()
instead of
is_category()