Forums

Replacing date with ID number (4 posts)

  1. artisan5
    Member
    Posted 3 years ago #

    How do I replace the php command which shows the date of a post with a command to show an ID or other type of tracking number instead such as Entry 1, Entry 2, etc.? Please include which file and section to place the code, since I'm not great at PHP yet. Many thanks...

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    You probably have the_date('') or the_time('') already, so you might try in your loop:
    `
    <?php
    echo 'typical post id in the loop '. $post->ID;
    ?>

  3. artisan5
    Member
    Posted 3 years ago #

    I tried replacing the_time code in the page.php template with the php you're suggesting. I must be doing something wrong because the date is still there under the article header.

    Should it look like this?

    <?php the_time(__(echo 'typical post id in the loop '. $post->ID;)) ?>

  4. MichaelH
    Volunteer
    Posted 3 years ago #

    <?php the_time(__(echo 'typical post id in the loop '. $post->ID;)) ?>

    should be:

    <?php
    echo 'typical post id in the loop '. $post->ID;
    ?>

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy
    the_time()

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags