Support

Account

Home Forums Add-ons Gallery Field Custom Fields in Gallery Array Reply To: Custom Fields in Gallery Array

  • Ok, it appears to be working. I changed your loop to look like this:

    //Fetch the gallery for the selected post
    $gallery = get_field('gallery', $post_id);
    if($gallery){
    	$i = 0;
    	foreach($gallery as $image){ //loop through the images in the gallery
    		
    		$gallery[$i]['constrain'] = get_field('constrain', $gallery[$i]['id']);
    		$i++;
    	}
    }

    Thanks for all of the help!