0

I'm trying to display all of my custom taxonomies using get_terms. This part is fine. But I'd like to display the taxonomies that have zero posts attached to them slightly differently.

Here's what I have so far: http://pastebin.com/k6sGXk0V

Can somebody point me in the right direction?

Many thanks, Mitch

1
  • Please post your code in your question Apr 8 '15 at 19:59
1

The number of posts attached can be found here: $term->count.

So you could do the following:

$class_empty_term = '';
if( $term->count == 0 )
    $class_empty_term = 'empty';
$term_list .= '<div class="' . $class_empty_term . ' grid__item ...">';
$term_list .= '<div class="panel text--center">';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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