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()

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