L
L
ligisayan2016-02-17 17:46:32
PHP
ligisayan, 2016-02-17 17:46:32

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

2 answer(s)
L
ligisayan, 2016-02-18
@ligisayan

In general, the correct function for output is:

function mad_is_product_category( $term = '' ) {
    return is_tax( 'product_cat', $term );
  }

M
Maxim Timofeev, 2016-02-17
@webinar

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 question

Ask a Question

731 491 924 answers to any question