I have a custom taxonomy for a custom post type. I need all available terms (and their descriptions) to display on a single post from this post type, regardless of if each term is applied to it. Basically if a post has the term it will be bold and if it doesn't have the term it will be greyed out but visible. I was able to get it to work with conditional statements for each term, but I want the client to be able to add or remove terms in the future without my having to update the template each time.

1 Answer 1


I was able to put this together from a similar question I found. If anyone else needs it:

$terms = get_terms( array(
    'taxonomy' => 'features',
    'hide_empty' => false
    ) );

    if (!empty($terms) && ! is_wp_error( $terms )) {
        echo '<section>';
        foreach ($terms as $term) {
            $class = has_term( $term->term_id, 'features' ) ? 'active' : 'unassigned';
            echo '<div class="term ' . $class . '"><h6>' . $term->name . '</h6>';
            echo '<div class="availability"></div>';
            echo '<p>'.$term->description.'</p></div>';
        echo '</section>';  
} ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.