- This topic has 3 replies, 2 voices, and was last updated 3 years, 5 months ago by Hash.
- AuthorPosts
- April 22, 2021 at 8:36 pm #33194nicodParticipant
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
NicoApril 23, 2021 at 4:42 pm #33232HashKeymasterYou 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;
}April 23, 2021 at 5:30 pm #33234nicodParticipantThis is great! So simple and yet so beautiful. 🙂 Works like a charm.
with kind regards
NicoApril 27, 2021 at 4:57 pm #33408HashKeymasterYes, please do a review of our theme if you like it https://wordpress.org/support/theme/viral/reviews/?filter=5
Thanks
- AuthorPosts
- You must be logged in to reply to this topic.