manalang

manalang

  • 09:20:17 pm on May 24, 2004 | # |
    Tags:

    Time Since plugin in actionIf 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:

    Time Since Plugin

    Download and save the file above as time_since.php into your/wp-content/plugins directory. 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() or the_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.

     

Trackbacks

close Reblog this comment
blog comments powered by Disqus