how do I change the modified time to be more time ago

Posted in: Newspaper
Post count: 14

Hello?
I want to change the modified date of the widget, post loop, and all the posts to the ‘ago’ format.
So I tried the code below,
In this way, The modified date for all articles is displayed as the modified date for the last article.
It may appear that the date of each post is not properly called.
Is there any difference in the newspaper theme ‘the_modified_time’?
Could you tell me what the problem is with this?
Thank you.

function my_post_time_ago_function() {
	$lastmodified = get_the_modified_time('U');
	return human_time_diff($lastmodified,current_time('U')).('ago');
}
add_filter( 'get_the_modified_date', 'my_post_time_ago_function' );
add_filter( 'the_modified_date', 'my_post_time_ago_function' );
Post count: 27744

Hello,

You can achieve the hours ago on blocks only with custom work, you can contact our team here => https://tagdiv.com/premium-customization-services/
If you want to use the “Time ago format” only for the post, you need to use a single post template from tagDiv Cloud Library and edit it with tagDiv Composer click on single post date and enable the “Time ago format” -> https://www.screencast.com/t/HcjkFySnV.

about this topic has been discussed here =>
https://forum.tagdiv.com/topic/implementing-the-time-ago/
https://forum.tagdiv.com/topic/changing-the-date-to-x-time-ago/
https://forum.tagdiv.com/topic/the-time-ago-in-block-3-is-correct-but-another-block-is-wrong-time/

Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.