Skip to content

Instantly share code, notes, and snippets.

@diego-castillo
Forked from webgurus/acf_slider_bootstrap
Created February 23, 2018 22:15
Show Gist options
  • Save diego-castillo/d11974e7359d159a0af3e592dddbaa98 to your computer and use it in GitHub Desktop.
Save diego-castillo/d11974e7359d159a0af3e592dddbaa98 to your computer and use it in GitHub Desktop.

Revisions

  1. @webgurus webgurus revised this gist Sep 3, 2013. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions acf_slider_bootstrap
    Original file line number Diff line number Diff line change
    @@ -3,12 +3,13 @@
    $images = get_field('slider_photos');
    $count=0;
    $count1=0;
    ?>

    if($images) : ?>
    <div id="slider">
    <div id="carousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
    <?php foreach( $images as $image ): ?>
    <?php foreach( $images as $image ): ?>
    <li data-target="#carousel" data-slide-to="<?php echo $count; ?>" <?php if($count==0) : ?>class="active"<?php endif; ?>></li>
    <?php
    $count++;
    @@ -27,4 +28,5 @@ $count1=0;
    ?>
    </div><!-- carousel inner -->
    </div><!-- #carousel -->
    </div><!--#slider-->
    </div><!--#slider-->
    <?php endif; ?>
  2. @webgurus webgurus created this gist Sep 3, 2013.
    30 changes: 30 additions & 0 deletions acf_slider_bootstrap
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    <?php
    /* SLIDER CUSTOM FIELD FOR HOMEPAGE */
    $images = get_field('slider_photos');
    $count=0;
    $count1=0;
    ?>
    <div id="slider">
    <div id="carousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
    <?php foreach( $images as $image ): ?>
    <li data-target="#carousel" data-slide-to="<?php echo $count; ?>" <?php if($count==0) : ?>class="active"<?php endif; ?>></li>
    <?php
    $count++;
    endforeach; ?>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
    <?php foreach( $images as $image ): ?>
    <div class="item<?php if($count1==0) : echo ' active'; endif; ?>">
    <img src="<?php echo $image['sizes']['slider-img']; ?>" alt="<?php echo $image['alt']; ?>" />
    </div><!-- item -->
    <?php
    $count1++;
    endforeach;
    ?>
    </div><!-- carousel inner -->
    </div><!-- #carousel -->
    </div><!--#slider-->