WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to echo at the end of a post which number the current post is?

For example;

Say you're viewing the 4th most recent post out of a total of 10, somewhere at the foot of the post I need it to say "Post 4/10"...

Is that possible?

share|improve this question
What you would like "total" to be of? All published posts? How do you want to calculate order - does 4th post becomes 5th if new one is published? – Rarst Jul 5 '13 at 13:40
Only published posts and yes, when a new post is published post 4 would become 5, 5 would become 6, etc. – Poisontonomes Jul 5 '13 at 15:02
up vote 3 down vote accepted

I would do this with $query->current_post and $query->post_count with $query = new WP_Query(args);. With this you may get the position and the total of posts.

share|improve this answer
Doesn't have to be new query, actually doing this with main query would be more fitting answer hint-hint. :) – Rarst Jul 5 '13 at 15:39
right ! but it can be a second loop. – JMau Jul 5 '13 at 16:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.