Show icons or badges under title on product archives category pages. So I was not able to solve my problem earlier, then I switched the plugin to Category and Taxonomy Image and used the following code to display the icons on category/archive
pages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | add_action( 'woocommerce_after_shop_loop_item', 'attribute_img_loop', 20 ); function attribute_img_loop() { global $product; // Check that we got the instance of the WC_Product object, to be sure (can // be removed) if ( ! is_object( $product ) ) { $product = wc_get_product( get_the_ID() ); } $token_imgs = get_the_terms( get_the_ID(), 'pa_token' ); foreach ( (array) $token_imgs as $token_img ) { $terms = $token_img->term_id; $meta_image = get_wp_term_image( $terms ); echo '<ul><li><img src="' . $meta_image . '" class="tokenimg" /></li></ul>'; } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.