Archived topic
How to Show "Last Updated Date" As Well As The Original Published Date?
11 replies · Started by Asen on December 6, 2021
Hey guys,
This should be an easy one but not sure how to make it work. I've read some similar post threads in vain.
On single posts, I'd like to show the "date last updated" along with the original published date.
How can I do this?
Many thanks in advance for your help!
Regards,
Asen
Hi there,
is this across the site ? ie. home page ( which is using WPSP ), blog/archives and single posts?
Hi!
Only on single blog posts.
Regards,
Asen
Simplest method is to create your own Post Meta with a Block Element:
https://docs.generatepress.com/article/block-element-post-meta-template/
Hey David,
Thanks for that.
I saw the documentation, but it's still not clear for my how to display the last updated date along with the original published data.
I also saw this document here https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
that shows this code: add_filter( 'generate_post_date_show_updated_only', '__return_true' );
but this is only for showing the last updated date and hiding the original published date.
Can you please help further?
Many thanks!
Hi Asen,
That documentation is for the default meta of the theme.
And yes you're correct. It's only for showing the updated date only.
We can actually do this with CSS if you're using the default meta. Try this one:
.posted-on .updated,
.posted-on .updated + .entry-date {
display: inline-block;
}
Here's how to add CSS -
https://docs.generatepress.com/article/adding-css/
Note: No updated date will display if the post has no history of modification.
Here's how David's suggestion would look like if executed -
https://share.getcloudapp.com/p9uXmZ7A
Thanks Elvin!
The CSS code didn't work well, but I tried the David's approach and I almost did it.
It's just that there's no space between "Last Updated On" and the actual date, even though there's such space when I create the element in Wordpress.
Check this out https://paste.pics/6a9ceb15ff6fdd716d0b594275332224 and https://paste.pics/G2UQH
Any advice?
Thanks in advance for your help!
Regards,
Asen
Did you include a space in your before text label:
Now I did added a space after "Last Updated On" and it works like a charm.
Thanks for the heads up.
Thanks very much!
Glad to hear that!
Actually I had to include a double space on the Last Updated on text in order for it to appear correctly when published.
Not sure why but I'm happy with the result. https://paste.pics/G2VY2
Might be WP stripping a single space. Glad to hear its working for you now