Support » Plugin: Advanced Category and Custom Taxonomy Image » Display all terms of an attribute with image in woocomemrce product page

  • Resolved theotheo

    (@theotheo)


    Hello,

    I am trying to display all attribute terms with an image in my content-single-product.php I understand the use of echo get_taxonomy_image( $term_id ); but how to i display images only for attributes that each individual product has.

    For example product1 has color:red size: medium attributes. How will i display this in product page with their image.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter theotheo

    (@theotheo)

    I use this function

                  function woo_new1_product_tab_content() {
        global $product;
    	$tax = 'champions'; // your taxonomy name
    	$terms = get_terms( $tax, ['hide_empty' => true] );
    	echo '<h4 class="widget-title">Champs</h4>';
    	foreach( $terms as $term ) {
    		 echo '<div class="taxo-text">' . $term->name . '</div>'; // display taxo text
    		echo '<img src="' . get_taxonomy_image( $term_id ) . '">'; // display taxo image 
    	}
    }
    Plugin Author Sajjad Hossain Sagor

    (@sajjad67)

    @theotheo Hi, sorry but your requirements are really not clear to me actually. Could you please give me some more details?

    Is this fn not working, is that what you are saying?

    function woo_new1_product_tab_content() {
        global $product;
    	$tax = 'champions'; // your taxonomy name
    	$terms = get_terms( $tax, ['hide_empty' => true] );
    	echo '<h4 class="widget-title">Champs</h4>';
    	foreach( $terms as $term ) {
    		 echo '<div class="taxo-text">' . $term->name . '</div>'; // display taxo text
    		echo '<img src="' . get_taxonomy_image( $term_id ) . '">'; // display taxo image 
    	}
    }
    Thread Starter theotheo

    (@theotheo)

    Yes it doesn’t work.

    What i want is each attribute/taxonomy value/term to have its image and display it in content-single-product.php

    • This reply was modified 2 months, 3 weeks ago by theotheo.
    Plugin Author Sajjad Hossain Sagor

    (@sajjad67)

    The above is the way to get taxonomy image… each taxonomy term value doesn’t have it’s own image!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.