Support

Account

Home Forums General Issues Taxonomy Term Image Reply To: Taxonomy Term Image

  • I’ve now got it working with the following code:

    <?php
        $terms = get_the_terms( get_the_ID(), 'product_brands' );
    
           if( ! empty( $terms ) ) : ?>
               <ul>	
    		<?php foreach( $terms as $term ) : ?>
    						    	 
    		 <li class="<?php echo $term->slug; ?>">
    															
                        <img src="<?php the_field('brand_logo', $term); ?>" />
    		  
                     </li>
    
      <?php endforeach; ?>
              </ul> 
    <?php
       endif;
    ?>

    I had to change the taxonomy name from brands to product_brands because I was already using a brands taxonomy for another CPT. However, this wasn’t the cause of the images not displaying, the only thing that was missing before was wrapping the <?php the_field(‘brand_logo’, $term); ?> in an image tag, seems obvious now.

    Are there any issues doing it this way?.