0

I'm using the Taxonomy Images plugin. Would like to list categories with their thumbnails AND descriptions. Code below give a list of categories (titles are linked to category archive) and thumbnails. I can't figure out how to add category description.

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' => 'category') );

if ( ! empty( $terms ) ) {

  echo '<div class="issue">';

  foreach( (array) $terms as $term ) {
      echo '<h3><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . $term->name . '</a></h3>';
      echo '<div class="grid col-60"><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumbnail-small' ) . '</a></div>';
      echo '<div class="grid col-780"><h4>In this issue</h4><p>[CATEGORY DESCRIPTION SHOULD GO HERE]</p></div>';
  }

  echo '</div>';

}

1 Answer 1

0

If I understand you correctly, you might try to replace

echo '<div class="grid col-780"><h4>In this issue</h4><p>[CATEGORY DESCRIPTION SHOULD GO HERE]</p></div>';

with:

echo '<div class="grid col-780"><h4>In this issue</h4><p>'. $term->description. '</p></div>';

i.e. $term->description to get the description part.

2
  • Awesome, thanks! Didn't work exactly how you wrote it, but works like this: echo '<div class="grid col-780 fit">'. $term->description . '</div></div>'; I was so over-complicating it! Thanks a lot
    – Phantasmix
    May 14, 2013 at 14:50
  • hehe thanks, I fixed this silly mistake I made ;-)
    – birgire
    May 14, 2013 at 14:57

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.