manalang
-
09:20:17 pm on May 24, 2004 | # |
If you read Simon Willison’s Weblog, you’re probably familiar with his time_since()PHP function (which was actually written by his girlfriend). This allows him to display the time elapsed since an entry was published. I took this code almost verbatim and created my first WordPress plugin. Here it is:Download and save the file above as time_since.php into your
/wp-content/pluginsdirectory. Then within WordPress, go to the Plugin’s section of your weblog admin and activate the Time Since plugin.This plugin will wrap any date or time (
the_date()orthe_time()) with an anchor element containing the elapsed time since the entry was published as a title attribute. This allows a user to hover over a date or time and see the elapsed time.Update: A few people have reported a problem with getting the exact elapsed time to calculate. I suspect this has something to do with a host server’s time (typically set to the local time) varying from the entry post’s time adjusted for the timezone. It works on this site since my host server’s time is the same as my weblog’s timezone adjustment configuration. I’ll have to find a fix soon. Just know that this is a known issue. Thanks to those who reported it.
Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks