conditional statement for custom taxonomy
Struggling to find out how to achieve this, if it is at all possible. The equivalent of is_category
but for a custom taxonomy I've set up. The taxonomy category if which being Taxonomy Name
with 2 taxonomies: Taxonomy One
and Taxonomy Two
. But this:
?php if ( has_term('taxonomy-one' ) ) {?
div class="test" style="color: red"?php the_field('field_name'); ?/div
?php } elseif ( has_term('taxonomy-two' ) ) {?
div class="test" style="color: green"?php the_field('field_name'); ?/div
?php } ?
There doesn't seem to be any documentation for this either so I'm not at all sure if it's possible, I'm hoping so though, any suggestions would be greatly appreciated!
Topic conditional-tags php taxonomy custom-taxonomy conditional-content Wordpress
Category Web