• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

How do i add time ago and time read on blogger

Valmirpn

New member
Aug 23, 2020
19
2
3
Please my friends I am using the GAMEIFY template I would like to add this script that changes the date and shows how long the post was and also shows the reading time. Please help me how to do it, someone teach me please
IMG_20230416_131952.png
 
read time if i not wrong, you can add it via plugins i think,
so they count the total word so we can calculate it

for x days ago... we can deal with it with system like this
date the article posted - current date = [x] days ago
if more than 365 days = 1 years ago

i think as simple as that, so you need to add simple counter on function
 
read time if i not wrong, you can add it via plugins i think,
so they count the total word so we can calculate it

for x days ago... we can deal with it with system like this
date the article posted - current date = [x] days ago
if more than 365 days = 1 years ago

i think as simple as that, so you need to add simple counter on function
I'm asking for help because I don't know. Which script and where do I add it in the template?
 
I'm asking for help because I don't know. Which script and where do I add it in the template?
on the template itself
maybe you can edit on single.php on show date section or other related php file since i not using theme that u used
 
on the template itself
maybe you can edit on single.php on show date section or other related php file since i not using theme that u used
there is no such option in the template. By God help me or direct me to a link that has the step by step please
 
there is no such option in the template. By God help me or direct me to a link that has the step by step please
create a code for it
you can found a code to count date/day on github or stackoverflow


but if i need to guide you to start to finish
sorry... i not free coder bro.... you can do that with your IT team....
 
Please my friends I am using the GAMEIFY template I would like to add this script that changes the date and shows how long the post was and also shows the reading time. Please help me how to do it, someone teach me please
Bro, the function in wordpress for this is human_time_diff()
U could slip this code at bottom of ur Theme functions.php:

For posts (posted on):-
PHP:
function my_timeago_post()
{
    return sprintf( esc_html__( '%s ago', 'textdomain' ), human_time_diff(get_the_time ( 'U' ), current_time( 'timestamp' ) ) );
}
add_filter( 'the_time', 'my_timeago_post' );

For comments (comment date) :-
PHP:
function my_timeago_comments()
{
    return sprintf( esc_html__( '%s ago', 'textdomain' ), human_time_diff(get_comment_time ( 'U' ), current_time( 'timestamp' ) ) );
}
add_filter( 'get_comment_date', 'my_timeago_comments' );

Its an internal wordpress function, so check wp.org codex (docs) for its documentation, and h ow to format certain way depending on whatever conditions u like. (eg: if older than x, then use weeks, or use days, or etcetc
 
bah only now i see blogger... well.. . go to wordpress source on github, or download wordpress and search its files for thsi human_time_diff function, and use that code
 

Latest posts

Forum statistics

Threads
79,486
Messages
1,143,662
Members
249,131
Latest member
abhishekgarg1
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock