show widget if child of a certain category
-
Hi,
I want to show a widget in a category sidebar only if it is a certain category or if it is a child of this category.
At the moment i am doing it with:
in_category(‘cat1’) || in_category(‘cat2’)cat1 is the parent category, cat2 is a child category of cat1
But this is not generic. Is there a better solution?
Thank you in advance, Markus
PS i tried the following already:
- is_category() && in_array($cat, get_term_children( 1, ‘cat1’)) … does not work
- in_category(‘cat1′,’cat2’) … does not work (and is also not generic)
- The topic ‘show widget if child of a certain category’ is closed to new replies.