Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Gallery ACF Shortcode

// Add Shortcode
function cux_gallery_embed_shortcode( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'gallery_custom_field_id' => 'all',
		),
		$atts,
		'cux_gallery_embed'
	);

	// Return custom embed code
	
	$image_ids = get_field($atts['gallery_custom_field_id'], false, false);
	$shortcode = '[' . 'gallery ids="' . implode(',', $image_ids) . '"]';
	
	echo do_shortcode( $shortcode );
	//return $shortcode;

}
add_shortcode( 'cux_gallery_embed', 'cux_gallery_embed_shortcode' );