I want to display content based on the current category and its parent category. To do that, I need to know if the current category is a subcategory of a specific parent category.
For example, these are my categories:
- Cars
- Sportcars
- Italian sportcars
- Sportcars
- Bikes
- Dirtbikes
- Japanese dirtbikes
- Dirtbikes
I now want to display the content in on every category archive down the category tree. In Cars, Sportcars and Italian sportcars for example.
For the first category I can use a Conditional Tag from WooCommerce:
is_product_category( 'cars' )
But there is no in_product_category()
. So I could not check, if the categegory "Italian sportcars" is a child of "Cars".
Is there any way to do that?