Support

Account

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)