Here is my complete shortcode:
function jmore_gallery(){
if( have_rows('galleries') ){
$GalleryCode='<div id="GalleriesContainer">';
while( have_rows('galleries') ): the_row();
$GalleryCounter=$GalleryCounter+1;
$GalleryID="custom-".$GalleryCounter;
$GalleryTitle=get_sub_field('gallery_title');
$GalleryArray=array();
$CaptionArray=array();
$GalleryCode.='<h2>'.$GalleryTitle.'</h2>';
$GalleryCode.='<div class="IndividualGalleryContainer">';
if( have_rows('image_gallery') ){
while( have_rows('image_gallery') ): the_row();
$ThisImage=get_sub_field('image');
$ThisImageShowCaption=get_sub_field('show_caption');
$ThisImageAltCaption=get_sub_field('alternative_caption');
$ThisImageID=$ThisImage['id'];
array_push($GalleryArray, $ThisImageID);
$ThisImageURL=$ThisImage['url'];
if($ThisImageShowCaption==1){//If captioning is turned on for this image
if(!empty($ThisImageAltCaption)){//Check if there is an Alternative caption added
$ThisImageCaption=$ThisImageAltCaption;//Puts the alternative caption in to the variable
$ThisImageCaption=str_replace(",",",",$ThisImageCaption);//Replaces commas with HTML character equivelant
}else{
$ThisImageCaption=$ThisImage['caption'];//Use caption associated with image from library
$ThisImageCaption=str_replace(",",",",$ThisImageCaption);//Replaces commas with HTML character equivelant
}
}else{
$ThisImageCaption="";
}
array_push($CaptionArray, $ThisImageCaption);
endwhile;//while( have_rows('image_gallery') ): the_row();
}
$GalleryIDs=implode(",",$GalleryArray);//Puts a comma after each ImageID except for the last one
//$GalleryCode.="Gallery IDs: ".$GalleryIDs."<br>";
$GalleryCaptions=implode(",",$CaptionArray);//Puts a comma after each Caption except for the last one
//$GalleryCode.="Gallery Captions: ".$GalleryCaptions."<br>";
//$GalleryCode.=do_shortcode('[soliloquy_dynamic id="'.$GalleryID.'" images="'.$GalleryIDs.'" captions="'.$GalleryCaptions.'"]');
$GalleryCode.=do_shortcode('[gallery slick_active="true" sl_show_caption="true" sl_dots="true" sl_fade="true" type="slideshow" size="large" sl_autoplay="true" link="none" ids="'.$GalleryID.'"]');
//$GalleryCode.=soliloquy_dynamic( array( 'id' => $GalleryID, 'images' => $GalleryIDs ) );
$GalleryCode.='<p> </p></div><!-- /IndividualGalleryContainer -->';
endwhile; // while( has_sub_field('galleries') )
$GalleryCode.='</div><!-- /GalleriesContainer -->';
}
return $GalleryCode;
}
add_shortcode('JmoreImageGallery', 'jmore_gallery');