Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.