Displays the number of years, months, days, hours and minutes since a post or a page was published or modified, or a comment was published.
<?php wp_days_ago_v3 ($stopUsingAjaxAfter, $showDateAfter, $showDateFormat, $showYesterday, $context); ?>
$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.
$showYesterday (boolean) (optional) Option to show the text "yesterday" if there is less than 24 hours since the post or page was published. Otherwise, the number of hours since the post or page was published will be showed until more than 24 hours have passed. Then, the number of days, etc, will be shown. The default value is true.
$context (int) (optional) The plugin needs to know in what context it's called. Available values are 1 (post/page published date), 2 (post/page last modified date), and 3 (comment published date). So if you want to show use the plugin to display a post's modified date, you use 2 as context when calling the plugin in your post/page loop. For comments published date, use 3 as context in your comments loop. The default value is 1.
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 translate the string "prepender" to "[none]" (without the quotes).
This same is the case for the word "ago". If your language does not use this word, German is one example, simply translate the sting "ago" to "[none]" (without the quotes).
Requires: 2.1 or higher
Compatible up to: 4.3
Last Updated: 2015-8-15
Active Installs: 2,000+
4 of 4 support threads in the last two months have been resolved.
Got something to say? Need help?