The Sweet Plugin: Date in a Nice Tone

10 Comments

Today’s late Sunday evening edition of The Sweet Plugin brings us to Date in a Nice Tone, a very simple plugin that gives you the ability to describe post dates in a more human, natural language. We use a modified version of the plugin on this blog, and implemented it in our 2010 redesign of the site.

The video is embedded at the top of this post’s page, with more about the plugin below.

Date in a Nice Tone

Date in a Nice Tone is a simple plugin, which is a good thing. Honestly it’s really just a function in a plugin file that you can use within your theme. As it should be. This plugin takes the current time, finds the difference between it and the time the post was published, and then presents a “human readable” version of the difference. It generates things like “3 hours ago” or “4 days ago” or “last month”.

If you would like to copy and paste the code snippet referenced in the video, here it is:

if ( function_exists( 'wp_date_in_a_nice_tone' ) ) { wp_date_in_a_nice_tone(); } else { the_time( 'F j, Y' ); }

 

Do you use Date in a Nice Tone, or something similar, to tell your readers when your content was published? What’s the best place to do it? Should dates be included in the URL structure as well?

Video recorded with a modified version 1.2 of Date in a Nice Tone, running WordPress 3.1.3.

Is your plugin worthy?

If you would like to see your plugin featured on an episode of The Sweet Plugin, send your plugin information over to [email protected]. We’ll see you tomorrow for another Sweet Plugin!

10 thoughts on “The Sweet Plugin: Date in a Nice Tone

  1. Is the short code snippet you show in the video that checks that the function is there available somewhere in text form? Thanks!

    • Sure, here you go:

      if ( function_exists( 'wp_date_in_a_nice_tone' ) ) {

      wp_date_in_a_nice_tone();

      } else {

      the_time( 'F j, Y' );

      }

      I’ve also added it to the post itself, if others would like to use it.

  2. Nice plugin. I think if you’re going to use this though, a way of seeing the exact date of a post should still be provided (maybe in the title tag associated with the element displaying your nice date.)

    Reason: When doing research and needing to cite sources, it’s essential to know precisely when a post was published. Fuzzy/nice-tone dates aren’t good in that regard.

Comments are closed.