This code displays the category thumbnail and title of the two parent categories for WooCommerce product categories.
I have several child categories I'd like to display as well. Is there way way to show all categories OR select which category IDs to display?
$taxonomyName = "product_cat";
$prod_categories = get_terms( $taxonomyName, array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => -1
) );
foreach( $prod_categories as $prod_cat ) :
if ( $prod_cat->parent != 0 )
continue;
$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' );
?><img src="<?php echo $cat_thumb_url; ?>" alt="" />
<a class="button" href="<?php echo $term_link; ?>"> <?php echo $prod_cat->name; ?> </a>
<?php endforeach;
wp_reset_query();