Home › Forums › ACF PRO › Loop to call Category Custom Fields using a taxonomy selection field › Reply To: Loop to call Category Custom Fields using a taxonomy selection field
Like so many problems, a weekend off and a fresh look solved things. My initial code must have had a error in it as fixing it turned out to be super simple:
<?php $terms = get_field('featured_topics'); if( $terms ): ?> <?php foreach( $terms as $term ): ?> <h5 class="text-center"><?php echo esc_html( $term->name ); ?></h5> <p><?php the_field('s_t_intro', $term); ?></p> <a href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?> blog posts</a> <?php endforeach; ?> <?php endif; ?>
Hopefully that might help someone in the future.
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!
© 2022 Advanced Custom Fields.