Archived topic
Can you display last modify date on posts somehow?
8 replies · Started by steven on April 9, 2022
Is it possible to get your theme to display last modified date on posts?
I regularly go back through my old posts and update them.
This would be a massive boon for all your users. It would help with SEO, CTR in SERPS, and let readers know that the article they are reading is up to date.
I've spent an hour trying to get this working with various bits of code, and finally just installed this plugin after none of it worked:
It doesn't display on the post though - I checked! As far as I know, it's supposed to add rich text markup to the post. I didn't see any either.
And I'd rather not use a plugin at all.
So can you help with this? It would be massively helpful...
Hi there,
you can add the snippet provided here:
https://docs.generatepress.com/article/generate_post_date_show_updated_only/
Then all dates will be the latest date.
Thanks David,
Sorry if this is obvious but add the snippet where?
Also does this add structured data markup schema so that Google et al are encouraged to add the markup to the serps? That's the biggest benefit by far..
Sorry - that code is PHP and this doc explains how to add it:
https://docs.generatepress.com/article/adding-php/
If you want json-ld structured data then you would need a SEO or schema plugin that provides json-ld
Hi David,
I've just bought the premium version of GeneratePress hoping this would be a built-in feature I could activate by checking a checkbox. Sadly, it isn't. So I've used the code you provided and the snippet plugin to get it working. However, I would like to display the text "Last modified on" or something similar before the date. Please can you provide the code to do this?
And do you have any plans to include these settings within the theme options?
Many thanks,
Stephen
Hi Stephen,
our direction is moving these kinds of changes to block based editing using the Block Element.
Here is an example to build your own Post Meta:
https://docs.generatepress.com/article/block-element-post-meta-template/
Does that method work for you?
If not, let me know and ill provide then PHP.
Hi David,
Thanks for your reply.
I got it to work using the Block Element but it took me around 30 minutes of fiddly work as I also wanted a downpipe | between my name and modified date so had to find the HTML for that. For somebody like me, who doesn't build sites for clients, having a simple checkbox/option inside the Customizer would be a much simpler option. Especially as I want to do this on a few sites.
Anyway, it's done! Thanks for your help.
Cheers,
Stephen
Sorry to hear of your frustration, but glad to hear you got it to work.
If theres a specific style you want to replicate across your sites, feel free to open a new topic and share us a link and we can take a look at the best option.
Thanks, David.
I will do.