Support

Account

Home Forums Pre-purchase Questions Gallery add-on Reply To: Gallery add-on

  • Hi @milanomia

    I have taken the code example from the gallery page and added in the counter variable code to show how this is possible.

    
    <?php
     
    
    /*
    *  Create the Markup for a slider
    *  This example will create the Markup for Flexslider (http://www.woothemes.com/flexslider/)
    */
     
    $images = get_field('gallery');
    $max = 4;
    $i = 0;
    
    if( $images ): ?>
        <div id="slider" class="flexslider">
            <ul class="slides">
                <?php foreach( $images as $image ): $i++; ?>
                	<?php if( $i > $max){ break; } ?>
                    <li>
                        <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
                        <p><?php echo $image['caption']; ?></p>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    <?php endif; ?>
    

    Thanks
    E