Home › Forums › General Issues › Get term ACF Image Field › Reply To: Get term ACF Image Field
Okay, using this code
<div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($className); ?>">
<div class="slider mobile-slider splide" data-splide='{ "type" : "loop", "perPage": "3", "arrows": 0, "breakpoints": { "99999": { "destroy": 1 }, "767": { "perPage": "1" } } }'>
<div class="splide__track">
<ul class="post-grid splide__list">
<?php
if( $molecules_of_the_month = get_terms( array( 'taxonomy' => 'molecules_of_the_month', $args ) ) ) :
foreach( $molecules_of_the_month as $month ) :
$summaryimage = get_field('summary_preview_image', 'term_' .$month->term_id ); // field, id and format value
// $summaryimage = get_field('summary_preview_image', 'term_name_', 'molecules_of_the_month'); // NULL++
$size = 'full'; // (thumbnail, medium, large, full or custom size)
// var_dump($summaryimage);
echo '<a href="' . esc_url( get_term_link( $month ) ) . '" alt="' . esc_attr( sprintf( __( 'View all post filed under %s', 'drughunter' ), $month->name) ) . '">'
. $month->name . '</a>';
endforeach;
endif; ?>
</ul>
</div>
</div>
</div>
I have the summaryimage
loading ids but not in use yet as I need image url. This so I can load the image, title and short description and link it all.
I also can still load term links using this loop and an echo
so that is fine. But need to work out loading image first.
Furthermore I need to include the $args
I had before. Not sure how with current setup. Doing some trials still.
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.