Display sequential post number/count (not post id)??
-
Hello,
I’m creating a small inspiration site, and I would like to number each post in chronological order.I thought this would be a piece of cake, but I’m not a PHP ninja, and while I’ve made a few themes, I just haven’t run across this functionality, so it may be easy, maybe not. I’ve seen it done pretty simply on numerous sites for comments. Just assumed it’d be simple for posts. Three hours worth of searching has turned up absolutely nothing.
Since the post ID’s jump around and aren’t perfectly numbered, I can’t use that for this.
I want the oldest published post to show a 1, second to show a 2, and so on, globally across the entire site, with the most recent showing the highest # — not resetting on each page full of posts — all the way up to the thousands I’ll end up having. This does not have to work on single.php, only really need it when showing X number of posts in the loop on index and subsequent pages.
So if I go to index and have 150 posts published on the total site, with 50 posts per page, I should see a # 150, 149, 148…101, Page 2 should show 100, 99…51, Pg 3 50,49…1
My initial guess was to begin playing with wp_count_posts or total_posts and count in some way, but I just don’t have the skills to dream it up from scratch. Could be completely wrong too ??
It’s just a minor site detail, I can live without it, but wanted to ask the question before giving up or doing it manually. Would really love this to be automated. Thanks.
- The topic ‘Display sequential post number/count (not post id)??’ is closed to new replies.