Custom post types – display incremental /serial number for each post
-
Hello,
I want to display an incremental/serial number in the title for each post of a list of a custom post type. I’ve found a few ways to do this, but I need the assigned number to be in “reverse” so that the newest post has the highest number. It’s for a podcast, so each post is an episode, so if the latest episode is 17, the next newest one is 16, etc.
I’ve found a few that work by adding code to
functions.php
, but they only apply to the default post type and don’t work with custom posts.I found this code, which displays the serial number but in the wrong order. With this code, the latest episode/post is number 1, the next newest number 2, etc.:
<?php echo($wp_query->current_post + 1); ?>
Is there an easy way to modify the above code to make it assign numbers in descending order rather than ascending?
Or is there any other way to achieve the number listing/display I need?
Thanks!
Jeremy
- The topic ‘Custom post types – display incremental /serial number for each post’ is closed to new replies.