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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.