current_post not working – give me -1 for every post
I try to get the current post index number and echo the number of this lesson(post)in a series of lessons(category).
I’m inside the loop on single.php page
my code looks like this:
$args = array( 'cat' => 22, ); $query = new WP_Query( $args ); echo $query->current_post; echo $query->post_count;
the “$query->post_count” works great and give me the number of the posts that are inside this category,
but the “$query->current_post” don’t work and give me “-1” all the time in every post…
what i’m doing wrong?