- This topic has 20 replies, 2 voices, and was last updated 2 months, 3 weeks ago by David.
May 28, 2020 at 2:06 pm #1305592vanya
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.May 28, 2020 at 8:45 pm #1305813LeoStaffCustomer Support
Can you try the code here?
Let me know 🙂May 29, 2020 at 1:34 am #1305997vanya
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.May 29, 2020 at 8:15 am #1306532LeoStaffCustomer Support
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/May 29, 2020 at 1:37 pm #1306964vanya
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?May 29, 2020 at 5:16 pm #1307100TomLead DeveloperLead Developer
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>.May 30, 2020 at 2:37 pm #1308117vanya
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/sqtrjtMay 30, 2020 at 2:44 pm #1308122vanya
Thanks 🙂May 30, 2020 at 4:09 pm #1308162TomLead DeveloperLead DeveloperMay 31, 2020 at 7:59 am #1308801Mikael
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?
ThanksMay 31, 2020 at 2:28 pm #1309139TomLead DeveloperLead Developer
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/May 31, 2020 at 10:02 pm #1309344Mikael
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?June 1, 2020 at 9:02 am #1310030LeoStaffCustomer Support
Try the CSS here?
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.June 1, 2020 at 9:16 am #1310045Mikael
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?
ThanksJune 1, 2020 at 1:54 pm #1310318DavidStaffCustomer Support
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.
- You must be logged in to reply to this topic.