I have created a taxonomy for my custom post type. The taxonomy is hierarchal and the name is featured and so is the slug. How can I write an if else so that if the taxonomy featured is checked off it shows x and if its not it shows y?
I have created a taxonomy for my custom post type. The taxonomy is hierarchal and the name is featured and so is the slug. How can I write an if else so that if the taxonomy featured is checked off it shows x and if its not it shows y?
Would it be possible to list an example? I'm trying to use <?php if() ?> to list posts that are using the featured taxonomy. I really am still learning so much of this so at this point I'm lost.
There is this:
<?php
// in post loop, if post has terms belonging to the taxonomy featured display a message
$terms = wp_get_post_terms( $post->ID , 'featured', '');
if ( !is_wp_error($terms) && $terms ) {
echo 'found featured terms on this post';
}
?>YES this worked thank you so much!
This topic has been closed to new replies.