lies-r of Yools DesignStars
4/13/2017 - 12:02 PM

Gallery in page

Gallery in page

[insert_php]
      $images = get_field('photo'); // ACF field name

        if( $images ): ?>
          <div class="acf-gallery">
              <ul>
                  <?php foreach( $images as $image ): ?>
                      <li>
                          <a href="<?php echo $image['url']; ?>" class="fancybox" rel="gallery">
                            <div class="gallery-img" style="background-image: url('<?php echo $image['url'] ?>');"></div>
                          </a>
                      </li>
                  <?php endforeach; ?>
              </ul>
        </div> <!-- .acf-gallery -->
      <?php endif; ?>
[/insert_php]
1. Create 'Gallery' custom field with the name 'photo' 
2. Place code on page
3. Install the plugin 'FancyBox for WordPress'
4. Add pics