<?php if (have_rows('gallery')):
$i = 1;
?>
<?php while (have_rows('gallery')): the_row();
$image_big = get_sub_field('image_big'); ?>
<div class="modal fade" id="galleryModal-b-<?php echo $i; ?>" tabindex="-1">
<div class="modal-dialog modal-dialog-centered w-auto">
<div class="modal-content">
<img class="img-fluid mx-auto" src="<?php echo $image_big; ?>"
alt="Image">
<div data-dismiss="modal" style="top:0;right:0;"
class="position-absolute modal-close font-alt fw-600 text-uppercase cursor-pointer z-index-1 text-white">
X Close
</div>
</div>
</div>
</div>
<?php if (have_rows('image_small')):
$i = 1;
?>
<?php while (have_rows('image_small')): the_row();
$image = get_sub_field('image');
?>
<div class="modal fade" id="galleryModal-s-<?php echo $i; ?>" tabindex="-1">
<div class="modal-dialog modal-dialog-centered w-auto">
<div class="modal-content">
<img class="img-fluid mx-auto" src="<?php echo $image; ?>"
alt="Image">
<div data-dismiss="modal" style="top:0;right:0;"
class="position-absolute modal-close font-alt fw-600 text-uppercase cursor-pointer z-index-1 text-white">
X Close
</div>
</div>
</div>
</div>
<?php $i++; endwhile; ?>
<?php endif; ?>
<?php $i++; endwhile; ?>
<?php endif; ?>
<?php if (have_rows('gallery')):
$i = 1;
?>
<?php while (have_rows('gallery')): the_row();
$image_big = get_sub_field('image_big'); ?>
<div class="modal fade" id="galleryModal-b-<?php echo $i; ?>" tabindex="-1">
<div class="modal-dialog modal-dialog-centered w-auto">
<div class="modal-content">
<img class="img-fluid mx-auto" src="<?php echo $image_big; ?>"
alt="Image">
<div data-dismiss="modal" style="top:0;right:0;"
class="position-absolute modal-close font-alt fw-600 text-uppercase cursor-pointer z-index-1 text-white">
X Close
</div>
</div>
</div>
</div>
<?php if (have_rows('image_small')):
$j = 1; // Другое название
?>
<?php while (have_rows('image_small')): the_row();
$image = get_sub_field('image');
?>
<div class="modal fade" tabindex="-1"
id="galleryModal-s-<?php echo $i; ?>-<?php echo $j; ?>"> <!-- А здесь двойной индекс -->
<div class="modal-dialog modal-dialog-centered w-auto">
<div class="modal-content">
<img class="img-fluid mx-auto" src="<?php echo $image; ?>"
alt="Image">
<div data-dismiss="modal" style="top:0;right:0;"
class="position-absolute modal-close font-alt fw-600 text-uppercase cursor-pointer z-index-1 text-white">
X Close
</div>
</div>
</div>
</div>
<?php $j++; endwhile; ?> <!-- Другое название -->
<?php endif; ?>
<?php $i++; endwhile; ?>
<?php endif; ?>