Post data in separate divs with incrementing class using WP_Query
The main query has a loop counter build in which you can access via $wp_query->current_post. This counter starts at zero, so you would most probably add one to that count, something like $wp_query->current_post + 1 Also, you don’t need to separately count posts, that is also an already build in function which you can access … Read more