How to add acf repeater field on a taxonomy template
We already posted how to Display Custom post type taxonomy’s image and text fields on taxonomy term page using ACF, Today we are posting How to add acf repeater field on a taxonomy template.
<?php // vars $queried_object = get_queried_object(); $taxonomy = $queried_object->taxonomy; $term_id = $queried_object->term_id; // load desc for this taxonomy term (term string) $thumbnail = the_repeater_field('taxslider', $taxonomy); ?> <?php while(the_repeater_field('taxslider', $taxonomy . '_' . $term_id)): ?> <?php if(get_sub_field('taxslimage', $taxonomy . '_' . $term_id)): ?> <img src="<?php the_sub_field('taxslimage', $queried_object); ?>" alt=""/> <?php endif; ?> <?php if(get_sub_field('01text', $taxonomy . '_' . $term_id)): ?> <h3><?php the_sub_field('01text',$queried_object); ?></h3> <?php endif; ?> <?php endwhile; ?>
Brilliant! I have been looking for this for weeks. Thanks!