WordPress.org

Ready to get started?Download WordPress

Plugin Directory

wp-days-ago

Displays the number of years, days, hours and minutes since a post or a page was published in the same format as Facebook, Twitter etc.

  1. Download the plugin.
  2. Unzip the contents of the downloaded file to the /wp-content/plugins/ directory of your WordPress installation.
  3. Log in to your WordPress dashboard and activate the wp_days_ago plugin that should now be visible in the list.
  4. You can now insert <? wp_days_ago_v3(); ?> anywhere in The Loop in your WordPress theme.

Usage

<?php wp_days_ago_v3 ($stopUsingAjaxAfter, $showDateAfter, $showDateFormat) ?>

$stopUsingAjaxAfter (int) (optional) The number of seconds since a post or page was published before the plugin should stop using AJAX to display information. The default value is 0, which means the feature is turned off and AJAX is never used. If you have a cached site and the cache update interval is a day or less, 86400 (one day) is a good value for the plugin. The reason for this is that one day after a post or page was published, the plugin will start to show information in daily intervals ("yesterday", "2 days ago", "3 days ago", etc). If the post or page was published less than a day ago, the plugin will update in smaller intervals ("10 minutes ago", "3 hours ago", "4 hours ago", etc) and AJAX is needed to ensure that this is displayed correctly on a cached site. The minimum value should be the cache update interval.

$showDateAfter (int) (optional) The number of seconds since a post or page was published before the plugin falls back to showing the actual date and time the post or page was published, instead of in its usual "X days ago" format. The default is -1 seconds, i.e. the feature is turned off by default.

$showDateFormat (string) (optional) The format the plugin should use to display the date and time a post or page was published if the number of seconds configured in the showDateAfter parameter has been reached. The default behaviour is to use the date and time formats configured in WordPress, but if this parameter is set, the date and time format it defines will be used instead of the format you have configured in WordPress. See Formatting Date and Time for other time and date formats if you want to override the configured formats.

Information for translators

There's a POT file in the languages folder if you want to translate the plugin into another language. If you do that, I'd really appreciate it if you could provide me with the PO/POT and MO file so it can be included in future versions of the plugin. You will of course be credited for your work.

In the POT file, there's a string called "prepender". This is for languages that need to prepend a word before the number in the string. An example is Norwegian, which will prepend the word "for" before the number: "For 2 dager siden". "For" is the prepender. Some languages doesn't use the prepender, English being a natural example. The Norwegian example is "2 days ago" in English. If your language doesn't need to use a prepender, simply leave the string untranslated.

Requires: 2.1 or higher
Compatible up to: 3.9.1
Last Updated: 2014-4-17
Downloads: 7,641

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,1,1
100,2,2
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1 100,1,1 100,1,1 100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
100,2,2