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 am trying to create a shortcode that would display woocommerce category title, thumbnail and description so far I can only display the thumbnail

        $prod_categories = get_terms( 'product_cat', array(
        'orderby'    => 'name',
        'order'      => 'ASC',
        'hide_empty' => 1
    ));
    foreach( $prod_categories as $prod_cat ) :
        $cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
        $cat_thumb_url = wp_get_attachment_thumb_url( $cat_thumb_id );
        $term_link = get_term_link( $prod_cat, 'product_cat' );


?>
<a href="<?php echo $term_link; ?>"><img src="<?php echo $cat_thumb_url; ?>" alt="<?php echo $prod_cat->name; ?>" /></a>
<a href="<?php echo $term_link; ?>"><?php  echo $prod_cat->name;  ?></a>
<?php  echo $term->description ;


endforeach; wp_reset_query(); 
share|improve this question

put on hold as off-topic by Pieter Goosen, Mark Kaplun, toscho Oct 17 at 19:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Pieter Goosen, toscho
If this question can be reworded to fit the rules in the help center, please edit the question.

    
echo $cat->name; should be echo $prod_cat->name. echo $term->description should be echo $prod_cat->description. –  Shazzad Aug 13 at 3:55

Browse other questions tagged or ask your own question.