I was wondering if someone could give me a hand. I would like to display the child categories of my woo commerce store categories along with the thumbnails I have set for them in my dashboard. I have set up two parent categories "Men" "Women". Under these two parents I have a few categories for each as children. From what I understand the woo commerce categories are formulated through a custom taxonomy. So I did not use
get_the_category() instead I used
get_terms(). I have used the code below, The thumbnails and the perma links work for each term but this code is still displaying the parent terms. Could someone please tell me what I am doing wrong here? I really appreciate the help!
<?php $taxonomyName = "product_cat"; $prod_categories = get_terms($taxonomyName, array( 'orderby'=> 'name', 'order' => 'ASC', 'hide_empty' => 1 )); foreach( $prod_categories as $prod_cat ) : $terms = get_terms($taxonomyName, array('parent' => $prod_cat->term_id, 'orderby' => 'slug', 'hide_empty' => false)); $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' ); ?> <li><a href="<?php echo $term_link; ?>"><img src="<?php echo $cat_thumb_url; ?>" alt="<?php echo $prod_cat->name; ?>" /></a></li> <?php endforeach; wp_reset_query(); ?>