Welcome to the MMOLEARN.COM

Build your first Dropshipping, Online Course, Affiliate, Blog, Business, Optin, etc, WEBSITE and make money with us. We offer over 10.000+ Wordpress Plugins & Themes which will let you build ANYTHING. Plus we have nice community which likes to gossip about building websites and making some money online! Its really easy to do when we have everything you need to BUILD anything you WANT. Hope you enjoy your stay and have a beautiful day with us!

or Register

How can I add the date and time to my blogger posts?

Batersch

Well-known member

Reputation: 29%
Joined
May 14, 2019
Messages
209
Reaction score
32
Points
46
Hello, I am currently using the GAMEIFY template and would like to integrate a script that modifies the date, displays the duration since the post was published, and indicates the estimated reading time. I would greatly appreciate any assistance or guidance on how to accomplish this.


3.png
 

BurgerFantasy

Active member

Reputation: 21%
Joined
May 13, 2019
Messages
147
Reaction score
23
Points
36
If I understand correctly, you're suggesting adding read time and time since the post was published using plugins and simple calculations.

For read time, you can indeed use a plugin that counts the total words and calculates the estimated reading time based on that.

As for displaying the time elapsed since the article was posted, you can use a system like this: Current date - date the article was posted = [x] days ago If the elapsed time is more than 365 days, display it as 1 year ago (or the appropriate number of years).

To achieve this, you'll need to add a simple counter function in your template or use an available plugin that offers these features.
 

Mamba

Well-known member

Reputation: 22%
Joined
Apr 9, 2018
Messages
144
Reaction score
21
Points
50
If I understand correctly, you're suggesting adding read time and time since the post was published using plugins and simple calculations.

For read time, you can indeed use a plugin that counts the total words and calculates the estimated reading time based on that.

As for displaying the time elapsed since the article was posted, you can use a system like this: Current date - date the article was posted = [x] days ago If the elapsed time is more than 365 days, display it as 1 year ago (or the appropriate number of years).

To achieve this, you'll need to add a simple counter function in your template or use an available plugin that offers these features.
I need assistance because I'm unsure. Which script should I add, and where in the template?
 

BonFrancine

Well-known member

Reputation: 27%
Joined
Jul 21, 2019
Messages
188
Reaction score
32
Points
54
I need assistance because I'm unsure. Which script should I add, and where in the template?
On the template, you could modify the 'show date' section by editing the single.php file or any related PHP file. Please note that I am not using the same theme as you are."

Essentially, the speaker is suggesting a way to customize a template by making changes to a specific PHP file that controls the display of the date. They clarify that their solution is tailored to their specific theme, which may differ from the one used by the listener.
 

Brodernsfi

Active member

Reputation: 23%
Joined
May 2, 2020
Messages
169
Reaction score
24
Points
41
On the template, you could modify the 'show date' section by editing the single.php file or any related PHP file. Please note that I am not using the same theme as you are."

Essentially, the speaker is suggesting a way to customize a template by making changes to a specific PHP file that controls the display of the date. They clarify that their solution is tailored to their specific theme, which may differ from the one used by the listener.
The template doesn't offer that particular option. Kindly assist me or guide me to a resource with detailed instructions, if possible.
 

Finnwarz

Well-known member

Reputation: 30%
Joined
Aug 12, 2019
Messages
204
Reaction score
38
Points
56
The template doesn't offer that particular option. Kindly assist me or guide me to a resource with detailed instructions, if possible.

You can locate code for counting dates/days on platforms like GitHub or Stack Overflow.

However, if you're seeking step-by-step guidance from start to finish, I apologize, but I am not able to offer coding services for free. I encourage you to collaborate with your IT team to achieve your desired outcome bro. Or seek some help via fiver..
 

Reveluris

Well-known member

Reputation: 26%
Joined
Sep 10, 2018
Messages
170
Reaction score
32
Points
56
Hello, I am currently using the GAMEIFY template and would like to integrate a script that modifies the date, displays the duration since the post was published, and indicates the estimated reading time. I would greatly appreciate any assistance or guidance on how to accomplish this.


View attachment 28281


Bruh, the function you need in WordPress for this task is human_time_diff(). You can insert the following code at the end of your theme's functions.php file:


For posts (posted on):-

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) :-


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' );


This is an internal WordPress function, so consult the wp.org Codex (documentation) for more information on its usage. You can learn how to format it in specific ways based on your desired conditions, such as displaying time in weeks or days if a post is older than a certain period, among other options.
 

Ivanteli

Active member

Reputation: 20%
Joined
Jun 10, 2019
Messages
163
Reaction score
11
Points
26
Sorry, I only just realized that you're using Blogger. Instead, you can find the 'human_time_diff' function in the source code of WordPress on GitHub, or you can download WordPress and search for the function within its files. Once you find the code, you can use it.. Good luck!
 
Top Bottom