Support

Account

Home Forums Front-end Issues Displaying Multiple Values from Custom Taxonomy Terms Reply To: Displaying Multiple Values from Custom Taxonomy Terms

  • UPDATE: Same settings as above but updated code. Now getting proper list of custom field id’s on my related term, but can’t seem to display the name instead of the ID.

    
    $queried_object = get_queried_object(); 
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;
    
    // load thumbnail and related industries for this taxonomy term
    $thumbnail = get_field('industry_image', $queried_object);
    $related = get_field('related_industries', $queried_object);
    print '<img src="';
    print $thumbnail;
    print '" class="industry-page-img" />';
         echo '<ul>';
         foreach ( $related as $term ) {
           echo '<li>' . $term . '</li>';
         }
         echo '</ul>';

    The above returns the image as expected, but only displays the proper term ID. I assumed printing the $term->name would display the field name, but it doesn’t.