Support

Account

Home Forums Add-ons Repeater Field Extract individual category name + link for repeater field Reply To: Extract individual category name + link for repeater field

  • Thank you! Your answer was a part of my solution. For anyone else who stumbles upon this thread and wants to do something similar, here’s my code that works in my project.

        <!-- start REPEATING THIS CONTENT - ICON/class card wrapper -->
        <?php if(have_rows('category_preview_offering')): ?>
    
        <div class="class-card-wrapper">
    
          <?php while(have_rows('category_preview_offering')): the_row();
            //Vars
            $image = get_sub_field('image');
            $term = get_sub_field('category_name');
            $taxonomy = 'category';
            $term_link = get_category_link($term[0]->term_id);
    
            if($term): ?>
    
            <div>
            <!-- start card one -->
            <!--  <a href="/index.php?cat=4"> -->
            <a href="<?php echo $term_link; ?>">
                <div class="icon_individual_card grow">
    
                    <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>">
    
                    <p class="icon_text_color blog_category_title"><?php echo $term[0]->name; ?></p>
                </div>
            </a>
          <?php endif; ?>
          </div>
            <!-- end card one -->
          <?php endwhile; ?>
    </div>
    <?php endif; ?>
    <!-- end ICON/class card wrapper -->
    </section>
    
    <!-- end BLOG CATEGORIES 3 ICON/class cards -->