Support

Account

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.