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 -->
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.