<?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; ?>