Home › Forums › General Issues › List Custom Taxonomy with Custom Fields › Reply To: List Custom Taxonomy with Custom Fields
You can either change to an image object or ID for return values. My preference is ID but it depends on if I need more than one image size.
If i’m only going to need one size I use ID and then wp_get_attachment_image_src()
http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src.
If I’m going to use multiple sizes the I have ACF return the image object.
For using the image object you would use something like this
$image = get_field('region_image', $term->taxonomy . '_' . $term->term_id);
$src = $image['sizes'][$size];
echo '<img src="' . $src .'"/>';
You can see the entire image object to help you work on it by doing this:
$image = get_field('region_image', $term->taxonomy . '_' . $term->term_id);
echo '<pre>'; print_r($image); echo '</pre>';
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.