This may seem a really trivial question.
I have a wordpress loop, and I need to number each looped element ascending.
So it will be like this... 1,2,3,4,5,6,7,8,9,10
Is there some php can do this?
<?php query_posts( 'posts_per_page=10' ); if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div id="list-<?php echo number(); ?>">
<?php get_template_part('item'); ?>
</div>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
Please see the div where I put number() - a made up function/
Thanks