Displaying ACF image field [closed]

I’m trying to display a list of all my custom taxonomy terms with an image field that I have created in ACF. The ACF image field I have is <img src="https://wordpress.stackexchange.com/questions/227989/<?php the_field("brochure_logo'); ?>">, but how can I display that image in my code below? I have left a gap where the field needs to go, but I can’t seem to output the image URL.

$taxonomy = 'brochure_categories';
$tax_terms = get_terms( $taxonomy );
?>
<ul class="downloadGrid">
<?php
foreach ( $tax_terms as $tax_term ) {
    echo '<li>';
    echo '<a href="' . esc_attr( get_term_link( $tax_term, $taxonomy ) ) . 
        '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . 
        '" ' . '>';

    echo  '<img src="    " >';
    echo  $tax_term->name;
    echo '</a>';
    echo '</li>';
}

2 Answers
2

You can pass the term object as the second parameter to the_field/get_field.

echo '<img src="' . get_field( 'brochure_logo', $tax_term ) . '">';

Leave a Comment