a number sequence starting at 0 (query_posts outside loop)
-
Im querying some posts outside the loop. everything going ok. Just cant figure out how to make each post have a number incrementing ~ starting from 0.
Usually I would just do a $variable++ like below but this code just restarts each instance ><
example :
<? query_posts('cat=4&showposts=50'); ?> <? while (have_posts()) : the_post(); ?> <? $img_counter = 0; $img_counter++; ?> <img class="<? echo $img_counter; ?>" /> <? endwhile;?>
This just makes each post return class=”1″. Is there a way I can have each come back 0, 1, 2, 3, and so on?
Any help would be much appreciated!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘a number sequence starting at 0 (query_posts outside loop)’ is closed to new replies.