Home › Forums › ACF PRO › How to use repeater fields for bootstrap carousel? › Reply To: How to use repeater fields for bootstrap carousel?
<div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
<!-- Overlay -->
<div class="overlay"></div>
<ol class="carousel-indicators">
<?php
$i=0;
while( have_rows('slideshow_images') ): the_row();
if ($i == 0) {
echo '<li data-target="#bs-carousel" data-slide-to="0" class="active"></li>';
} else {
echo '<li data-target="#bs-carousel" data-slide-to="'.$i.'"></li>';
}
$i++;
endwhile; ?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<?php
$z = 0;
while( have_rows('slideshow_images') ): the_row();
$image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
<div class="item slides <?php if ($z==0) { echo 'active';} ?>">
<div style="background: url(<?php the_sub_field('image'); ?>);max-height:500px;height: 100%; background-size: cover; background-position: center center; background-repeat: no-repeat;"></div>
<div class="hero" style="width:96%;">
<hgroup>
<h1><?php the_sub_field('title');?></h1>
<h3><?php the_sub_field('sub_title');?></h3>
</hgroup>
<a href="<?php the_sub_field('image_links_to'); ?>"<button class="btn btn-hero btn-lg" role="button"><?php the_sub_field('links_to_text'); ?></button></a>
</div>
</div>
<?php
$z++;
endwhile; ?>
</div>
</div>
try if this works.
PS: i cant see private post from 28feb, and please edit first post (look that every tag is closed “forum tags”, not inside php code, specially li and ul/ol to get rid of layout-prob inside this thread)
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.