first loop which will be create a html and second loop will be create image links, I'm using Lightbox2 plugin to show the images in lightbox gallery.
If each image has same attribute the plugin will be load all of them as a one gallery, but if has different attribute it will show them as a single image.
So what i want is to set a unique attribute for each loop. That's what i did is here:
<? while ( has_sub_field('info') ) :
$j = 0;
?>
<li>
<div class="thumbs">
<? while( have_rows('images') ): the_row(); ?>
<a data-lightbox="building-<?= $j++ ?>" href="<?php echo $image_full_url; ?>"
title="<? echo $attachment->post_excerpt ?>">
<div id="aks"><img src="<?php echo $image_url; ?>"></div>
</a>
<? endwhile ?>
</div>
</li>
<? endwhile ?>
As you can see i set the attribute to data-lightbox="building-<?= $j++ ?>"
but it is giving me different value for each image.
Where i should define the $j
, so each group of image has different attribute?