/* From http://codex.wordpress.org/The_Loop_in_Action */
if( ($wp_query->current_post + 1) < ($wp_query->post_count) )
Monday, June 4, 2007
Getting a Count of Posts in The Loop in WordPress
I had a hard time finding this information. Here's how you can get a count of the number of posts in your current loop and the index of the current post you're accessing. post_count starts at zero and current_post starts at 1. In this example, I'm outputting a horizontal rule after all posts except the last one in the loop.