Forums

Making IDs show up with 3-digits (5 posts)

  1. viitoria
    Member
    Posted 4 years ago #

    I'd like to have my post-ID show up in front of the title and link that to the permalink instead of the title. However, I'd like them to seem a bit more uniform. (Eg, 001, 002, ... 017, ... 785) instead of how it works now (Eg, 1, 2, 17, 785, etc). Is there a snippet that would allow me to do this? Thanks.

  2. Kafkaesqui
    Moderator
    Posted 4 years ago #

    A not so well known WP function will work here:

    $id3 = zeroise($post->ID, 3);

  3. viitoria
    Member
    Posted 4 years ago #

    Where exactly would I put this?

    (I use the tag <?php the_ID(); ?> - from what I can understand of the code you gave, it seems to have a specific id in mind...

  4. Kafkaesqui
    Moderator
    Posted 4 years ago #

    You can replace

    <?php the_ID(); ?>

    with

    <?php echo zeroise($post->ID, 3); ?>

  5. viitoria
    Member
    Posted 4 years ago #

    Ah, I see. Sorry.

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.