Support

Account

Home Forums ACF PRO Trying to display selected taxonomy terms and their images on home page. Reply To: Trying to display selected taxonomy terms and their images on home page.

  • I figured this out. I totally misused the repeater field which caused an unnecessary headache.
    Anyway, this is the code I used. It’s a modified version of this code – https://support.advancedcustomfields.com/forums/topic/query-custom-taxonomy-name-and-link-inside-repeater/

    Hope this helps someone out.

    <?php
      // loop through the repeater
      if (have_rows('catimg_repeater')) {
        while (have_rows('catimg_repeater')) {
          the_row();
        $term = get_sub_field('choose_category');
        $term_link = get_term_link($term);
        $image = get_sub_field('choose_image');
    	$url = $image['url'];
    	$alt = $image['alt'];
          ?>
            <a href="<?php echo $term_link; ?>"><img src="<?php echo $url ?>" alt="<?php echo $alt ?>" /></a>
        <?php
    		} // end while have rows
    	  } 
    	?>