I won’t elaborate on how to use the code below unless you leave a comment and let me know what’s unclear. The plugins below enabled this on my project site
- Toolset
- ACF Pro
- Repeater field with one of the sub-fields being of type Image
- Justified Image Gallery from justifiedgrid.com
- Oxygen Builder – the best page builder ever!
<?php // retrieves the attachment ID from the file URL function pippin_get_image_id($image_url) { global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url )); return $attachment[0]; } if( have_rows('gallery_mua') ): // loop through the rows of data //echo "<textarea cols=140 rows=30>"; while ( have_rows('gallery_mua')) : the_row(); //echo "display? "; //echo get_sub_field('displaypic'); //echo "\n"; //echo "the id: "; //echo pippin_get_image_id(get_sub_field('image')); $image_array_jig .= pippin_get_image_id(get_sub_field('image')); $image_array_jig .= ","; //echo "\n"; //echo "image: "; //echo get_sub_field('image'); //echo "\n"; //echo "caption: "; //echo get_sub_field('caption'); //echo "\n"; //echo "featured: "; //echo get_sub_field('featured'); //echo "\n"; //echo "category: "; //print_r(get_sub_field('category')); //echo "\n"; //echo "tags:"; //print_r(implode(', ', get_sub_field('pictags'))); //echo "\n"; //echo "\n"; //echo "==========="; //echo "\n"; //echo "\n"; endwhile; //echo "</textarea>"; else : // no rows found endif; //echo "<br><br>"; //echo $image_array_jig . "<br>"; $image_array_jig = rtrim($image_array_jig, ','); //echo $image_array_jig . "<br>"; echo do_shortcode ('[justified_image_grid preset=5 ids="'. $image_array_jig . '"]'); //echo do_shortcode ('[justified_image_grid ids="86, 82, 89, 88"]'); ?>