I had added the following code to fuctions.php and also tried code snippets plugin
function show_last_modified_date( $content ) {
$original_time = get_the_time('U');
$modified_time = get_the_modified_time('U');
if ($modified_time >= $original_time + 86400) {
$updated_time = get_the_modified_time('h:i a');
$updated_day = get_the_modified_time('F jS, Y');
$modified_content .= '<p class="last-modified">This post was most recently updated on '. $updated_day . '</p>';
}
$modified_content .= $content;
return $modified_content;
}
add_filter( 'the_content', 'show_last_modified_date' );
but instead of showing “last updated date” on post templete; it shows last updated date on the very top of all the pages and posts.
Is there any way to display “last modified date” only on “single post template 15” below the published date(see in image).
https://lastdna.com/elephants-without-tusks/
Hi,
Please read this topic -> https://forum.tagdiv.com/topic/last-update-date-post/
Hope this will help you.
Thanks.
@calin Which file should I edit for single post templete 15?
Hi,
You are using a tagDiv Cloud template and if I understand correctly you want to set the time ago format, if is so please edit the template and click an date -> https://www.screencast.com/t/gwU61XUQ
Hope this will help you.
Thank you.
I’m using td cloud template, single post template 15.
I want to show:
1. “Last modified on” date on each post.
2. Also, I don’t want to remove “published date”.
3. Which file’s code should I edit to show the both “last modified on ” & “published on”.
Hope you understand.
Please see the images attached in above topic.
Hi,
In order to edit the post cloud template you need to go in wp-content/plugins/td-cloud-library/shortcodes/single/tdb_single_date.php
https://www.screencast.com/t/w9vkzW6rNPe
Thank you.
Sorry to say that but you are not understanding my problem.
Problems:-
1.Post template , It shows “Published Date”.
2. I want to show both “Published Date” and the “Last Modified date.
Solutions for:-
1. How can I show “Last modified” date without replacing the “Published date”.
2. I want to show “Last modified” date below the “Published date”.
If it is not possible then I want to show the “Last Modified” date on the top of “post content”.
Please provide the required code.
I am using td cloud library: single template 15.
Thanks,
Hope you understand my problem and try your best to solve my problem.
Hi,
That modification will replace the publish date with the last updated date. If you wish to have both don’t replace the code, add the publish date code below the default code. Just as Bogdan mentioned in another topic.
Like this example for post template 2
– https://www.screencast.com/t/B76LhZOm3
– https://www.screencast.com/t/Isu8pBty6pAw
You can add some more design if needed.
Thanks
Hi,
Hire is the code
$buffy .= '<div class="entry-date updated td-module-date">'.get_the_modified_date('l,F j,Y').' </div>';
https://www.screencast.com/t/X5wdGt2xF
https://www.screencast.com/t/W1IOA5A1
Hope this will help you.