Im using a loop to make a slider. My code is
<?php
query_posts( array( 'post_type' => 'my_gallery', 'author'=>$author->ID ) );
while( have_posts() ) :
the_post();
$imagethum = eh_postImage(115, 70);
?>
<a data-slide-index="0" href=""><?php echo $imagethum; ?></a>
<?php endwhile; ?>
I need the data-slide-index="0"
attribute to increase by 1 for every post in the loop so the output appears as...
<a data-slide-index="0" href="">
<a data-slide-index="1" href="">
<a data-slide-index="2" href="">
<a data-slide-index="3" href="">
<a data-slide-index="4" href="">
<a data-slide-index="5" href="">
after printed
Some kind of for each
statement here?
query_posts
, it is never a good idea, instead WP_Query objects, the pre_get_posts filter or the get_posts function are your friend