Easy Relative Date

Easy Relative Date is a simple plugin to add relative date supports on wordpress powered websites, like ‘Today’, ‘Yesterday’, ‘2 Days Ago’, ‘2 Weeks Ago’, ‘2 ‘Seconds Ago’, ‘2 Minutes Ago’, ‘2 Hours Ago’. The main advantage of the plugin is that it doesn’t override standard wordpress the_date() and the_time() functions, so you can use these functions if you need as well.

Usage

Easy Relative Date can be used for entries as well as for comments. For entries use this code in your template:

if(!function_exists('easy_relative_date')){the_time('F jS, Y'); } else { echo easy_relative_date(get_the_time('U')); }

For comments use:

if(!function_exists('easy_relative_date')){comment_date() . ' at ' . comment_time(); } else { echo easy_relative_date(get_comment_time('U')); }

Pretty easy, and a great way to change up your theme, and possibly make it more relevant since people understand and usually think in relative terms.

Download

Easy Relative Date (116)

5 Responses to “Easy Relative Date”

  1. baron said:

    Aug 17, 09 at 8:23 am

    Works great, thank you

    Like or Dislike: Thumb up3 Thumb down0

  2. Jerry said:

    Aug 17, 09 at 3:16 pm

    It seems this code is not compatible with the threaded comment system, which hides the call to the time function in (if memory serves, which is far from likely) Walker.php, taking it out of template control. It’s really a problem with the comment implementation forsaking templates, but still a pain in the patoot. Any suggestions?

    (Also, you’re collecting spam in your comment thread.)

    Like or Dislike: Thumb up2 Thumb down0

  3. Nico said:

    Oct 07, 09 at 10:19 am

    I really like your plugin but when it is active I can’t write new posts. WP says the following:

    Warning: Cannot modify header information - headers already sent by (output started at […]/wp-content/plugins/easy-relative-date/easy_relative_date.php:1) in […]/wp-includes/classes.php on line 1586

    what can I do? please help!

    Like or Dislike: Thumb up1 Thumb down0

  4. jez said:

    Oct 24, 09 at 12:07 pm

    I am getting:

    The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression

    so as soon as I activate the plugin the entire site dies.

    any ideas?

    Like or Dislike: Thumb up0 Thumb down0

  5. mugger said:

    Nov 23, 09 at 12:12 pm

    Directions seem to not be complete for making
    ‘Today’, ‘Yesterday’, ‘2 Days Ago’, ‘2 Weeks Ago’, ‘2 ‘Seconds Ago’, ‘2 Minutes Ago’, ‘2 Hours Ago’.

    Like or Dislike: Thumb up0 Thumb down0


Leave a Reply