2

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?

  • 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
3

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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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