Archived topic
Insert 'Last Updated On' date for all blog articles
3 replies · Started by rajjj on November 21, 2022
Hi Team,
How do I have the date of post published with 'Last updated on (updated date)' right under the blog title?
I have used the code add_filter( 'generate_post_date_show_updated_only', '__return_true' );
But it just changes the published date. How can I have it show the date as 'Last updated on with the date'
Hi Rajj,
To clarify, do you want to show just the updated date or the published date(if there's no updated date). Or, do you want to show both if the updated date is available?
Just need the date to be displayed as 'Last updated on date'.
It there is no update, the date will be the date when it was published.
Hi there,
add this PHP Snippet to your site:
add_filter( 'generate_post_date_output','tu_add_to_post_date' );
function tu_add_to_post_date( $output ) {
return '<span class="date-label">Last updated on </span>' . $output;
}
How to add PHP:
https://docs.generatepress.com/article/adding-php/