Hi
I am having some issues getting an ACF image field (array) from a taxonomy and displaying it in a loop on a page.
I am looping through the Taxonomy terms with the following code. Its showing the term name and description no problem, but its not picking up the ACF field. Any ideas?
<?php
$terms = get_terms(
array(
‘taxonomy’ => ‘tipo_reparacion_mob’,
‘hide_empty’ => false,
)
);
$repair_icon = get_field(‘repair_type_icon’, $terms . ‘_’ . $term_id);
if ( ! empty( $terms ) && is_array( $terms ) ) {
foreach ( $terms as $term ) { ?>
<div class=”swiper-slide”>
<div class=”swiper-slide-inner”>
<?php if( !empty( $repair_icon ) ): ?>
<div class=”swiper-slide__icon”>
” alt=”<?php echo esc_attr($repair_icon[‘alt’]); ?>” />
</div>
<?php endif; ?>
<h3 class=”heading–tertiary heading–mb-sm”>
<?php echo $term->name; ?>
</h3>
<p>
<?php echo $term->description; ?>
</p>
</div>
</div>
<?php
}
}
?>
Thanks
I have managed to resolve this using:
<?php $repair_icon = get_field(‘repair_type_icon’, ‘tipo_reparacion_mob_’ . $term->term_id . ” ); ?>
Thanks