Admin Side Option Image Gallery using ACF Fields And Get This Image Backend (Shortcode) [ Light Box ]


 /* Products Single Page Application */

function product_sample_func( $atts )

{

ob_start();

$images = get_field('product_sample_gallery');

$size = 'full'; 

if($images):

echo '<div class="pro_sample_wrapper">';

echo '<ul>';

foreach( $images as $image_id ):

$image_url = wp_get_attachment_image_src($image_id, $size);

?>

<li>

<figure>

<a data-elementor-open-lightbox="yes" data-elementor-lightbox-slideshow="6b82d93" href="<?php echo $image_url[0]; ?>">

<?php echo wp_get_attachment_image( $image_id, $size ); ?>

</a>

</figure>

</li>

<?php

endforeach;

echo '</ul>';

echo '</div>';

endif;

$output = ob_get_contents();

ob_end_clean();

return $output;

}

add_shortcode( 'product_sample', 'product_sample_func' );