[Resolved] Incrementing number within WP_Query?
I’m setting up a photo gallery for my WordPress site, and for navigation purposes I need to increment a link’s data-slide-index value by 1 for every post.
So far nothing I’ve tried as worked, and I suspect it’s because I’m using multiple loops on the page via WP_Query.
Here’s my loop. Can anybody tell me what I need to do here?
<?php $photo_thumbs = new WP_Query('post_type=photo-gallery&posts_per_page=100&order=DESC'); while ($photo_thumbs->have_posts()) : $photo_thumbs->the_post(); ?> <div class="thumb"> <span class="mid"><a data-slide-index="VALUE TO BE INCREMENTED" href=""><?php the_post_thumbnail('photos_thumbnails'); ?></a></span> </div> <?php endwhile; wp_reset_postdata(); wp_reset_query(); ?>
- The topic ‘[Resolved] Incrementing number within WP_Query?’ is closed to new replies.