Archived topic
Last Updated in meta data
20 replies · Started by vanya on May 28, 2020
Hello Guys, I can see that this topic has been talked a lot but something is not working for me.
I tried this https://generatepress.com/forums/topic/post-updated-date/#post-470725 but something was going wrong.
I want to show "Last Updated" in the meta data if the post was modified.
And show "Original Published" date if the post was never modified.
Please help me with this.
Hi there,
Can you try the code here?
https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
Let me know :)
I added all these codes in snippets separately like this - https://prnt.sc/spwvj7
This is what I achieved https://prnt.sc/spwxc4
The meta data now just shows published date and author name.
I want to show “Last Updated” in the meta data if the post was updated.
And show “Original Published” date if the post was never updated.
I'm not sure what's included in each snippet by looking at the name unfortunately.
Can you make sure this CSS is also added which is needed for the front end?
https://docs.generatepress.com/article/show-the-updated-post-date/
Adding CSS: https://docs.generatepress.com/article/adding-css/
I was able to achieve something like this https://prnt.sc/sqb4vz
I finally need to put some space after the date
Any code for that?
Are you using this code?: https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
If so, the space comes from that extra space you see after the closing </span>.
It seems you did not got my question.
There is no space between the date "May 29, 2020by admin"
I need it like "May 29, 2020 by admin"
I need space after year https://prnt.sc/sqtrjt
Resolved.
I referred this post : https://generatepress.com/forums/topic/make-a-space-between-the-post-date-and-the-authors-name/
Thanks :)
Glad you got it working :)
I followed this post and can see there is a code to get the last updated date displayed - where do I need to add this code to get it to work?
Thanks
Hi there,
You would copy this code: https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
And add it using one of these methods: https://docs.generatepress.com/article/adding-php/
Thanks.
Is there something I can add to the code so it actually says "Last updated" in front of the date?
And if I add it to the functions.php in the child theme, does it matter where I add it or can I just add it at the end?
Try the CSS here?
https://docs.generatepress.com/article/show-the-updated-post-date/
And if I add it to the functions.php in the child theme, does it matter where I add it or can I just add it at the end?
Adding it to the end should work.
Great. Thank you.
Can I ask why I need to add something in the functions.php file? because I tried adding just the CSS you just shared and it shows the updated date just by adding this and without adding anything to the functions.php.
Is there something I am missing by not adding the code you shared previously to the functions.php first?
Is the CSS just what people see but when it is also added to the functions.php Google will also read the updated date or what is the difference?
Thanks
Hi there,
by default GeneratePress outputs both the Published and Updated date - but it hides the updated date with CSS. So yes you can use some CSS to change which one is displayed.
The PHP function changes what is output. So instead of outputting both Published and Updated dates it will only output the most recent one.
Some say this is more likely to get Google to display the Updated date.