[resolved] code-newbie needs help with "last updated" (3 posts)

  1. joah
    Posted 5 years ago #

    I've been trying to get a "Last updated: (date)" attached to the frontpage items, based on whether the creation time and last-modified time are equal or not.

    I am a total newbie when it comes to coding php, but here's what i tried:

    <?php if (the_time('F j, Y') != the_modified_time('F j, Y')) : ?><i>updated <?php echo the_modified_time('F j, Y'); ?></i>
    <?php else : ?> test
    <?php endif ?>

    Ofcourse, this isn't working. I also tried

    <?php if (the_date != the_modified_date) : ?><i>updated <?php echo the_modified_time('F j, Y'); ?></i>
    <?php else : ?>poop
    <?php endif ?>

    The thing is, I would like to have it show when a post has updated content, but [i]not[/i] when the timestamp is equal to the modified stamp.

    Do you have any suggestions?

  2. f00bar
    Posted 5 years ago #

    This link might help:


    It returns the last modified post date.

  3. joah
    Posted 5 years ago #

    That was not exactly what i needed, but it pointed me into the right direction!

    This worked:

    <?php if (get_the_time('F j, Y H:i') != get_the_modified_time('F j, Y H:i')) : ?><i>updated <?php echo the_modified_time('F j, Y H:i'); ?></i>
    <?php else : ?>
    <?php endif ?>


Topic Closed

This topic has been closed to new replies.

About this Topic