Time Since Plugin

At the bottom of each post on this site, a wonderful little WordPress plugin adds how long it’s been since the post was made. It’s called Time Since. But there’s a bug in the example ‘how to use’ code… actually a few, so I’m posting updated examples of how to use the plugin here in the hope that people wondering why this plugin won’t work for them as instructed on their site will pick up on it. Good luck!

Since Entry Publication:

<?php if (function_exists('time_since')) {
echo time_since(abs(strtotime($post->post_date_gmt . " GMT")), time()) . " ago";
} else {
the_time('F jS, Y');
} ?>

Since Comment Publication:

(I don’t use this second example, so I haven’t tested it, but the problem appears to be identical.)

<?php if (function_exists('time_since')) {
echo time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time()) . " ago";
} else {
the_time('F jS, Y');
} ?>

Leave a Response



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



  • Search
  • Meta

  • Old Browser

    It seems you are using an old web browser (e.g. Internet Explorer 5 or below). This is a security risk to you, since Microsoft no longer releases updates for old versions of Internet Explorer. Also, note that this site is designed to modern internet standards, and the layout may appear strange or plain in older browsers. All the content is still accessible to you, but I strongly recommend you upgrade to a modern, safe, standards-complient browser, such as Firefox. For more information on getting the best experience surfing the web, see browsehappy.com.