Support

Account

Home Forums Add-ons Gallery Field Adding class to first gallery item Reply To: Adding class to first gallery item

  • Try this,

    <?php
    $images = get_field(‘product_page_images’);
    if( $images ):
    ?>
    <div class=”carousel-inner” role=”listbox”>
    <?php $count = 0; foreach( $images as $image ):?>
    <div class=”item <?php if (!$count): ?>active<?php endif; ?>”>
    ” alt=”<?php echo $image[‘alt’]; ?>” />
    </div>
    <?php $count++; endforeach; ?>
    </div>
    <?php endif; ?>