Hi I have a little problem with php/wordpress and can't find answer.
There is a list and one <li>
I want to show, when anything in custom taxonomy is set:
<li class="">Taste: <span><a href="#"><?php printRecipeTaste($post_ID); ?></a></span></li>
I have some php in another <li>
which is working like I want but only for meta:
<?php if ( get_post_meta( get_the_ID(), 'iba', true ) ) : ?>
<img class="iba" src="<?php echo esc_url(home_url('/')); ?>/images/iba.jpg" alt="" />
<?php endif; ?>
I tried with get taxonomy_exists and is_taxonomy but I fail.
Anyone can help? Ty.
You should be able to use get_the_terms($id, $taxonomy)
. Returns false if no terms of that taxonomy are attached to the post.
https://codex.wordpress.org/Function_Reference/get_the_terms