Home › Forums › ACF PRO › How to use repeater fields for bootstrap carousel? › Reply To: How to use repeater fields for bootstrap carousel?
<?php
$count = 0;
while( have_rows('carousel') ): the_row();
if ($count == 0) {
echo '<li data-target="#bs-carousel" data-slide-to="0" class="active"></li>';
} else {
echo '<li data-target="#bs-carousel" data-slide-to="'.$count.'"></li>';
}
$count++;
endwihle; ?>
try something like above.
and try to adapt it for slide too. (define counter outside of while, check for first counter add there the active. do else, and increase count before endwhile)
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.