Archived topic
How to show only updated date on blog and search engine
13 replies · Started by Mfon on January 6, 2020
Hello,
I have tried without success to show only updated post not published date on posts and search engine. Can you help?
Hi there,
add the PHP Snippet provided here to force the Theme to only output the modified date ( if it exists ):
https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
Whether the search engine chooses to display an updated date is down to their algorithms, the theme itself cannot force it to change
Where do I add this? FUnction.php or hook?
In your child theme functions.php or use the code snippets plugin.
more info her:
Thank you.
I will like to show it in this format Updated: January 10, 2020
Can you help on this?
Look for this line in the code:
$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>';
and change it to:
$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Updated: %4$s</time>';
Thank you. My biggest concern is changing the date format to something like this January 10, 2020
You can change the date format in Dashboard > Settings > General - it should still work with that function enabled.
Oh my bad! I forgot!
Thank you
Happy to be of help :)
Thanks again
You're welcome
Hello,
The code has stopped working :(
Hi there,
Can you share the exact code you're using?
Also, can you make sure the date is enabled in Customize > Layout > Blog?
Let me know :)