Displaying post order number in archives

Let’s say you have taken over a website for a podcast. Each time a episode of this podcast is produced, a WordPress post is published that provides information about that episode. There are over 500 episodes to date.

You’ve been tasked with displaying the podcast episode number in the podcast archives, and you’d rather not manually add custom meta for each of the 500+ episodes.

We’ll show you how to:

  1. Get the total count of published posts in a certain post type.
  2. Count backwards as you iterate through the WordPress loop.
  3. Adjust the episode number accordingly through paged archives.
  4. BONUS: Make it work with Jetpack Infinite Scroll too.

This is the exact same effect I use on the Themetry website to give visitors a visual idea of what number tutorial they’re on in the index.

Let’s begin!

To read the rest of this tutorial, you will need a Pro account.

Leave a Reply

Your email address will not be published. Required fields are marked *