WordPress Timeago Plugin: Twitter Like Fuzzy Dates in WordPress
With web 2.0, it has become common to have fuzzy date/time (e.g. “3 minutes ago”, “10 days ago”). Twitter, Facebook, Gmail, you name it — all the big guns are following the trend.
Bloggers using WordPress should also be following this trend, just like all other social media. WordPress, by default, doesn’t have fuzzy dates support. So, I have created a plugin that uses the popular timeago jQuery plugin to create automatically updating fuzzy date/time.
Why?
- The fuzzy date/time updates live while you are on the page, without requiring page reload.
- It makes your site appear more lively and user friendly.
- timeago uses microformats.
- Fuzzy date is applied to the comments automatically, even if the default wordpress comments loop is being used. No painful rewriting required.
- Shows time relative to user’s timezone. Normally, the date/time displayed by wordpress is based on the timezone set in wordpress configurations.
Installation:
- Download and extract the zip archive.
- Upload the plugin.
- Activate the plugin from Admin CP.
- Ensure it works (more below).
Make it work!
By default, the plugin automatically converts your date and times into fuzzy equivalent. However, it’s not perfect and may not work or appear out of context on many themes.
In that case, you will have to edit your theme templates (index.php, single.php, etc.) and replace the default the_time() / the_date() template tags with the_time_ago() (provided by the plugin).
Usage: (while in the loop or comments loop)
<?php the_time_ago(); ?>
When you need to define a custom format (displayed on mouse-over), use as following:
<?php the_time_ago('d M, Y'); ?>
Translation
Edit the file jquery.timeago.js and locate the section where it says “Translate here”. You can either modify it manually or use one of the many translations available at timeago’s repository.
Keep In Touch
Leave your suggestions and comments below, and don’t forget to subscribe to our RSS Feed and follow us on Twitter to stay updated.

Asad, thank you for this
Have to agree with you, little details like this fuzzy time makes a blog more live & human reader friendly.
Agreed. In my opinion, this feature should be standard for wordpress comments!
What do others think?
Hello,
Don’t know if you follow the support forums, so I’m posting a link here:
http://wordpress.org/support/topic/378337
Hi!
Sorry but i found bug?
I have problem…
http://hpguru.net/blogini-on-nyt-yhteiso/#comments
Just say to you great plugin and i want use this but…
I don’t see first comment sender name. Ok, second and name is gone. Why?
How i fix it?
It appears you’re using a custom comments loop. Edit wp-content/plugins/timeago/timeago.js, find and remove:
$('.comment-meta a:first').each(function() {
var timeago = $(this).children('.timeago');
if (timeago) {
$(this).html(timeago);
}
});
And good blog i add this blog rss to my rss reader.
And now it’s work! Thank you for this tip.
Like your plugin!
Any thoughts on making this work on the auto updates from the p2 theme. I can’t figure out how to make it work with the ajax updates. Works great on normal page loads by editing the entry.php file with the_time_ago(). Started a thread on the plugin page.
If the theme modifications rely on AJAX requests to add data, try something like this at bottom of jquery.timeago.js file:
$(document).ajaxStop(function() { setTimeout(function() { $("abbr.timeago").timeago(); }, 20); });You need to call $(“abbr.timeago”).timeago(); every time you append new content to the DOM.
Hello,
im using your plugin and its excellent. But – in archive pages it didnt work quite well, because its showing “Archive for 16 day ago” instead of “Archive of April”. Its somehow possible to fix it?
Thanks!
Just found another bug. In theme Therapy from WooThemes the plugin hide comment author’s name and shows only “5 minutes ago” – no name.
@jp: Due to custom comment loops being used, use the solution I suggested to Jyri.
Thanks for pointing out the archives issue. Currently, the fix is to edit your archive.php file of the theme and use echo get_the_time(…); instead of the_time(…) in “Archive for …” text.
For example:
<h2 class="pagetitle">Archive for <?php echo get_the_time('F, Y'); ?></h2>
On one of my pages it will say the time and then spits out “GMT -4″ next to all times. Any thoughts?
Thanks for the response above but it did not seem to make a difference for the new posts in the P2 them which I think get pulled in from http://svn.automattic.com/wpcom-themes/p2/inc/ajax.php but I’m not all that sure. I would love to use your plugin so if you have any other suggestions I would certainly try them.
Thanks again.
Sorry i’m back but i would ask you one question…
I now notified that your plugin works in wp admin area. Now i have in admin panel for example: Commentname X posted 3 minutes ago @ 3 minutes ago.
Before: Commentname X posted 03.07.2010 @ 22:45.
How i disable your plugin from admin panel?
Thank you.
Andd sorry for my bad English…
I modofied Finnish fi.mo and now all is good in admin panel… Minute or two work on every new updated fi.po -> fi.mo but works…
Hi there,
I’m using this translation:
// Spanish
jQuery.timeago.settings.strings = {
prefixAgo: “hace”,
prefixFromNow: “dentro de”,
suffixAgo: “”,
suffixFromNow: “”,
seconds: “menos de un minuto”,
minute: “un minuto”,
minutes: “unos %d minutos”,
hour: “una hora”,
hours: “%d horas”,
day: “un día”,
days: “%d días”,
month: “un mes”,
months: “%d meses”,
year: “un año”,
years: “%d años”
};
But AJAX is having trouble to show the special chars í and ñ.
How can be this issue solve?
Thanks for great plugin. It’s very useful!
Can you tell me how to disable converting dates into fuzzy format, in comments list only.
Thanks!
Hello,
the plugin conflicts with Editorial Calendar http://stresslimitdesign.com/editorial-calendar-plugin
If you find a solution, I will be happy.
Any plans for an option to limit when the plugin works? “1215 days ago” just isn’t pretty. How about only reformatting the date if the comment was made 24hours ago, or within a week?
Cheers!
Great plugin!
I was wondering is it’s possible to start displaying the regular date after 7 days. For example a post that is over a week old would display September 10th, 2012 with no time. Is that possible?
Hi Asad,
The plugin seem very interested! I really loved to use it between i would like to have customized with my own requirements here below;
just now
less than minutes
a minute ago
X minutes ago
about hour ago
X hours ago
X day ago
X days ago (shows up to 5 days)
if over days show (F j, Y)
I would love to have those requirements if you can provide me the custom code i’d be happy to use this plugin and this plugin seem very interesting always as well with live updating… You can contact me via email kbg.sulaiman@gmail.com for more further information… And thanks for developing this awesome plugin.
Thanks!
Sulaiman.