0
 <?php
$meta = get_post_meta($postid, '_urunler_gallery1',true);

$image_id = get_post_thumbnail_id();
$image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);
$image_title = get_the_title($image_id);
    $image = "";
    //<li> yi döndüren foreach
    foreach ($meta as $fileurl):        
?>
 
 <a href="<?php echo $fileurl;?>" data-fancybox="gallery" data-caption="<?php echo $image_alt ?> ">
        <img src="<?php echo $fileurl;?>" alt="<?php echo $image_alt ?>" class="img-fluid mb-2" />
        
  </a><
 <?php endforeach;?>

In this code just echo first image title in all photos.Rersult is like this . All images getting first image title (Kitaplık 1)

How can I write each photos title Can you help me please?

GET IMAGE ALT FROM CMB2 FILE FILED IN LOOP CMB2

0 Answers0