In this example:
Ajax Load More will lazy load a gallery of images from Advanced Custom Fields using the ACF extension.
The Gallery field for Advanced Custom Fields provides a simple and intuitive interface for managing a collection of images – Ajax Load More is used to loop over each image and display the results with infinite scrolling (lightbox functionality is not included).
The following shortcode was used to create the Gallery Field example.
[ajax_load_more preloaded="true" preloaded_amount="4" posts_per_page="4" seo="true" acf="true" acf_field_type="gallery" acf_field_name="alm_gallery" seo="true" container_type="div" images_loaded="true"]
Note: In this example, alm_gallery is the name of the ACF Field Group. Ajax Load More will loop over each image in this gallery field to build the infinite scroll listing.
The following Repeater Template was used to create the Gallery Field example.
<a href="<?php echo $image['url']; ?>" class="popup">
<img src="<?php echo $image['sizes']['alm-gallery']; ?>" alt="<?php echo $image['alt']; ?>" />
Note: $image will always be the variable name returned from Ajax Load More when using the Gallery field type.