Support

Account

Home Forums Add-ons Repeater Field Query custom taxonomy name and link inside Repeater Reply To: Query custom taxonomy name and link inside Repeater

  • So it’s the first one ๐Ÿ™‚

    
    <?php 
      // loop through the repeater
      if (have_rows('home_sections')) {
        while (have_rows('home_sections')) {
          the_row();
          // see: http://www.advancedcustomfields.com/resources/taxonomy/
          $term = get_sub_field('event_category');
          // I'm assuming that the taxonomy is "event_category"
          // change next line if that's wrong
          $taxonomy = 'event_category';
          $term_link = get_term_link($term, $taxonomy);
    
          // assuming you're returning image array
          //see: http://www.advancedcustomfields.com/resources/image/
          $image = get_sub_field('category_image');
          ?>
            <a href="<?php 
              echo $term_link; ?>><img src="<?php 
              $image['url']; ?>" alt="<?php 
              echo $image['alt']; ?>" /></a>
          <?php
        } // end while have rows
      } // end have rows
    
    ?>