Support

Account

Home Forums ACF PRO How to use repeater fields for bootstrap carousel? Reply To: How to use repeater fields for bootstrap carousel?

  • hi, i think the main part should look like this

    <?php $carousel = get_field('carousel');
            if($carousel):
            while( have_rows('carousel') ): the_row();
    
    	$slider_image	= ""; 
    	$slide_headline	= ""; 
    	$sub_headline	= ""; 
    	$button_url	= ""; 
    	$button_text	= ""; 
    
    	$slider_image	 = get_sub_field('slider_image');
    	$slide_headline	 = get_sub_field('slide_headline');
    	$sub_headline	 = get_sub_field('sub_headline');
    	$button_url	 = get_sub_field('button_url');
    	$button_text	 = get_sub_field('button_text');
    ?>
        <div class="item slides">
          <div class="cslide" style="background: url(<?php echo $slider_image; ?>)"></div>
          <div class="hero">
            <hgroup>
                <h1><?php echo $slide_headline; ?></h1>        
                <h3><?php echo $sub_headline; ?></h3>
            </hgroup>
            <a href="<?php echo $button_url; ?>"><button class="btn btn-hero btn-lg" role="button"><?php echo $button_text; ?></button></a>
          </div>
        </div>
    <?php endwhile; endif;?>

    hope that help.
    depends on what is required, and what your image output is, you may need to adjust your code. here a sample how to make a optional field and get image when use array

    <php? if($my_teaserimage){
            echo '<div class="teaserimage"><img src="'. $my_teaserimage['url'] .'" /></div>';
            } ?>