- This topic has 16 replies, 4 voices, and was last updated 2 years, 11 months ago by
Ying.
-
AuthorPosts
-
March 25, 2023 at 3:36 pm #2582065
Adrian
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.
March 26, 2023 at 4:49 am #2582480David
StaffCustomer SupportHi there,
quick question do you want to only show the one date ? ie. the most recent date.
March 26, 2023 at 6:17 am #2582592Adrian
Hi David,
Yes, I think just showing the ‘Last Updated’ (i.e. most recent) date is all I need.
March 26, 2023 at 8:41 am #2582910David
StaffCustomer SupportOk:
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: '; }March 26, 2023 at 9:49 am #2582989Adrian
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: ‘;
}March 26, 2023 at 11:08 am #2583073Ying
StaffCustomer SupportNo, 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/March 26, 2023 at 11:09 am #2583074Adrian
Already sorted. Apologies, my brain was on a go slow. Not tested yet but should be ok. Will confirm shortly.
March 26, 2023 at 11:14 am #2583077Adrian
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?
March 26, 2023 at 11:32 am #2583095Ying
StaffCustomer Support1. 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.
March 26, 2023 at 11:37 am #2583098Adrian
Ok, snippet disabled.
Here is a link to the post in question: https://thevoiceoftech.com/how-to-afford-a-gaming-pc/
March 26, 2023 at 11:41 am #2583103Ying
StaffCustomer SupportThanks!
I can see both dates in the HTML.
Now can you turn on the PHP code?
Let me know!
March 26, 2023 at 11:49 am #2583113Adrian
no change Ying
March 26, 2023 at 12:02 pm #2583126Ying
StaffCustomer SupportThe 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?
March 26, 2023 at 12:08 pm #2583131Adrian
I used WPCode Code Snippets plugin. Cache plugin also disabled.
March 26, 2023 at 5:17 pm #2583303Fernando Customer Support
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
-
AuthorPosts
- You must be logged in to reply to this topic.