⚡⚡Flash Sale⚡⚡ Get 20% off any Purchase!!! Limited Time Peroid Only!!! 🔖 Use Coupon Code FLASH at checkout.

Home Forums Viral Add modified date to published date

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33194
    nicod
    Participant

    Hi, I have been a WordPress user for a long time, so some of my articles are quite old, but still usefull for my readers. I update them regularly. That’s why I would like to add the last modified date to the publish date. The code to do so should be:
    `$u_time = get_the_time(‘U’);
    $u_modified_time = get_the_modified_time(‘U’);
    if ($u_modified_time >= $u_time + 86400) {
    echo “<p>Last modified on “;
    the_modified_time(‘F jS, Y’);
    echo ” at “;
    the_modified_time();
    echo “</p> “; }

    But where (in which file and in which line) should I add this code? Preferably the published date with the ‘clock-icon’ should be published first and then on the same line the modified date.

    Thanks,
    With kind regards
    Nico

    #33232
    Hash
    Keymaster

    You don’t need to edit the code for it. Also on the update of the theme, all the edits get lost.

    There is another way. Go to Appearance > Customize > Additional CSS and paste the below CSS code

    .posted-on .published{
    display: none;
    }

    .posted-on .updated{
    display: inline;
    }

    #33234
    nicod
    Participant

    This is great! So simple and yet so beautiful. 🙂 Works like a charm.

    with kind regards
    Nico

    #33408
    Hash
    Keymaster

    Yes, please do a review of our theme if you like it https://wordpress.org/support/theme/viral/reviews/?filter=5

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.