Answer the question
In order to leave comments, you need to log in
How to limit output only for pages with product categories?
Hello! There is an online store on wordpress + woocommerce. I want to display certain information for pages with product categories (and nothing more!), but if I set conditions options: if(is_archive()) {..}
or if(is_archive('product')) {..}
the same thing is displayed on pages with article headings. How to limit output only for pages with product categories?
Answer the question
In order to leave comments, you need to log in
In general, the correct function for output is:
function mad_is_product_category( $term = '' ) {
return is_tax( 'product_cat', $term );
}
Are you sure that if(archive()) and not if(is_archive())
read here: wp-kama.ru/function/is_archive
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question