Support » How-To and Troubleshooting » [Resolved] Is there a way to number archive posts

[Resolved] Is there a way to number archive posts

Viewing 15 replies - 1 through 15 (of 16 total)
  • How would that number happen? A sequential number? Does the same number always have to be associated with the same post?




    Is there any php code that I can use to number the post titles that appear in the archive section.

    Number how? random numbers? sequentuial numbers? fake numbers? chinese numbers? what?????

    Ive done both ascending and descending sequential numbering of posts, and included paging. It was quite easy to do.

    I’m not sure how much it matters but i’d be interested to see an example of paged sequential numbering in the archive.

    Would you care to give an example whooami? 🙂 Please 🙂




    paged, ordinal numbering? youve never seen that????

    First page

    1. post
    2. post

    Second page

    3. post
    4. post

    Yes have seen it, just not sure i remember seeing that behaviour in WP by default… or am i experiencing a terrible blonde moment?




    it doesnt do it by default, no, youre right 🙂

    So would you care to enlighten me on how you’d handle paging archive results as per my basic example above?…

    Seen lots of methods for paging (some beyond me), i’d be interested to see how you do it…




    you should understand this 🙂

    <?php if (empty($paged)) { $my_post_count = 1;} else { $my_post_count = ($paged*$posts_per_page)-($posts_per_page-1); } ?>

    Mind you I pulled that out of a file I havent used in 2 years.

    I toyed with doing this again, when I redid v-i, and the code I used there was slightly different, I *think*..

    I’ve not worked with $paged or $posts_per_page in WordPress.

    I assume they are global WP variables that track the page/post results, or count so to speak… so we don’t end up on pages for no results etc…

    I’ll check the codex…

    p.s. what’s v-i? 🙂




    v-i == my site.

    its really simple,

    take the above, add a little of this:

    <?php echo $my_post_count; $my_post_count++; ?>

    and youre off.

    I’ve no need for numering archives yet myself, having only 10 or so posts, it seems a little pointless, but i’ll bear the above in mind when need be…

    I’ll let the OP have his thread back, i’m sure he has questions…. 😉

    I meant sequential numbers and no the same numbers don’t always have to be associated with the posts, sorry if I wasn’t clear earlier.


    I tried adding this:

    <?php echo $my_post_count; $my_post_count++; ?>

    to my archives.php. And it works but for some reason the first post is not counted. Beginning from the second post the numbering starts. Also the numbers don’t have a period after them , so now they are 1 2 3 instead of 1. 2. 3.

    sorry but the only php I know is copy pasting the code 🙁

    Could reverse that:

    <?php $my_post_count++; echo $my_post_count; ?>

    Thanks MichaelH!

    That worked great now the numbering starting from the first post. Any idea though how I can get a period after each number, e.g. 1. 2. 3. ?

    Thanks for your help.

    <?php $my_post_count++; echo $my_post_count . ‘.’; ?>

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] Is there a way to number archive posts’ is closed to new replies.