Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>';

}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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 '13 at 14:50
    
hehe thanks, I fixed this silly mistake I made ;-) –  birgire May 14 '13 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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