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
?>
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.