Archived topic
How to show Last Updated wording and new date when updating a blog post
16 replies · Started by Adrian on March 25, 2023
Hi,
How can I make a change to GeneratePress that enables the wording 'Last Updated' followed by the new date on my blog posts please? At the moment my blog posts only show the original post submission date. I would like users to known that my content gets updated.
Thanks.
Hi there,
quick question do you want to only show the one date ? ie. the most recent date.
Hi David,
Yes, I think just showing the 'Last Updated' (i.e. most recent) date is all I need.
Ok:
1. Add this PHP Snippet to your site:
https://docs.generatepress.com/article/generate_post_date_show_updated_only/
This will make it so the latest date is always displayed.
2. Add this CSS to add the Last Updated label:
.entry-meta time:before {
content: 'Last updated: ';
}
Thanks David.
Just to confirm, I need to add the following to the additional CSS section in Customize:
add_filter( 'generate_post_date_show_updated_only', '__return_true' );
.entry-meta time:before {
content: 'Last updated: ';
}
No, Adrian, it's PHP code, not CSS code.
Use one of the methods introduced in the below article:
https://docs.generatepress.com/article/adding-php/
Already sorted. Apologies, my brain was on a go slow. Not tested yet but should be ok. Will confirm shortly.
Ok, just tested and after amending a post I find that the post just shows the words Last Updated, followed by the original post date instead of the new date following a change to the post. How do I get around that please?
1. Make sure cache is cleared.
2. Remove this PHP for now so that I can check if the updated date is logged:
add_filter( 'generate_post_date_show_updated_only', '__return_true' );
3. Link us to the post.
Ok, snippet disabled.
Here is a link to the post in question: https://thevoiceoftech.com/how-to-afford-a-gaming-pc/
Thanks!
I can see both dates in the HTML.
Now can you turn on the PHP code?
Let me know!
no change Ying
The PHP code doesn't seem to be working, I can still see two dates.
How did you add the PHP code?
And can you temporality disable your cache plugin?
I used WPCode Code Snippets plugin. Cache plugin also disabled.
Hi Adrian,
Can you provide admin login credentials? We'll take a closer look to see why it isn't working.
Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information