I am wondering how can I write a conditional tag that affects a custom taxonomy slug and its children?
Found this in WordPress Codex:
is_tax( 'flavor', 'mild')
When the archive page for the flavor
taxonomy with the slug of ‘mild’ is
being displayed.
However with this code only ‘mild’ slug archive page is affected and not it’s children taxonomy terms.
Thanks!
I have a handy little function that i based on post_is_in_descendant_category function
it expends the is_tax to check if its the term or any of his children
and you use it just the same so instead of:
is_tax('flavor', 'mild');
you put:
is_or_descendant_tax(get_term_by( 'name', 'mild', 'flavor' ), 'flavor');
or if you are using term id instead of name then:
is_or_descendant_tax(12, 'flavor');
and you are set.