cat_is_ancestor_of not working. My brain is cooked!!
-
I’ve searched and tried so many different code snippets, but none seem to work.
GOAL: Show the Product Search Form at the top of ONLY the “Parts” category and it’s subcategories.
Right now, I’m using the following code in my woocommerce.php template, and it only shows the search form on the top category, Parts, and not on any of it’s subcategories:
<?php if ( is_product_category(76) || cat_is_ancestor_of(76, get_query_var( 'cat' )) ) { get_product_search_form(); echo '<hr>'; } ?>
I also tried this:
<?php if (is_product_category( 'parts' ) || cat_is_ancestor_of( 76, get_queried_object()->term_id) ) { get_product_search_form(); echo '<hr>'; } else { // } ?>
and various other things.
Anyone have any idea how to do this?
thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘cat_is_ancestor_of not working. My brain is cooked!!’ is closed to new replies.