{"id":22687,"date":"2013-04-01T15:01:20","date_gmt":"2013-04-01T15:01:20","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/relative-date-template-tag\/"},"modified":"2013-09-18T22:54:06","modified_gmt":"2013-09-18T22:54:06","slug":"relative-date-template-tag","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/relative-date-template-tag\/","author":10072957,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.6","stable_tag":"1.0.6","tested":"3.5.2","requires":"3.5.0","requires_php":"","requires_plugins":"","header_name":"Relative Date Template Tag by InternetAlche.Me","header_author":"Eric Allen","header_description":"","assets_banners_color":"","last_updated":"2013-09-18 22:54:06","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/ericrallen\/wp-relative-date-template-tag","header_author_uri":"http:\/\/internetalche.me\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1388,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","trunk"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[4708,1426,3623],"plugin_category":[40],"plugin_contributors":[95378],"plugin_business_model":[],"class_list":["post-22687","plugin","type-plugin","status-closed","hentry","plugin_tags-dates","plugin_tags-relative-date","plugin_tags-template-tag","plugin_category-calendar-and-events","plugin_contributors-ericrallen","plugin_committers-ericrallen"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/relative-date-template-tag.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Adds <code>the_relative_date()<\/code> and <code>get_the_relative_date()<\/code> template tags to your arsenal of template tags.<\/p>\n\n<p>These template tags will return the relative time passed since the post was published, like \"12 hours ago\" or \"3 weeks ago.\"<\/p>\n\n<p>Tag to Print Relative Time:<\/p>\n\n<pre><code>&lt;?php the_relative_date(); ?&gt;\n<\/code><\/pre>\n\n<p>Tag to Retrieve Relative Time:<\/p>\n\n<pre><code>&lt;?php get_the_relative_date(); ?&gt;\n<\/code><\/pre>\n\n<h3>Options<\/h3>\n\n<p>When calling either template tag you can pass a few optional parameters via an array to customize the value that is returned.<\/p>\n\n<p>Example:<\/p>\n\n<pre><code>&lt;?php \/\/print relative date as \"X periods ago\"\n\/\/where periods is the largest time period that can be calculated for the current post where X &gt;= 1\nthe_relative_date(); ?&gt;\n<\/code><\/pre>\n\n<p>Example:<\/p>\n\n<pre><code>&lt;?php \/\/retrieve relative date as \"X periods ago\"\n\/\/where periods is the largest time period that can be calculated for the current post where X &gt;= 1\nget_the_relative_date(); ?&gt;\n<\/code><\/pre>\n\n<p>Example:<\/p>\n\n<pre><code>&lt;?php \/\/relative date args\n$params = array(\n    'period' =&gt; 'minutes'\n);\n\n\/\/get relative date as \"X minutes ago\"\nget_the_relative_date($params);\n<\/code><\/pre>\n\n<p>Example:<\/p>\n\n<pre><code>$params = array(\n    'period' =&gt; 'days',\n    'suffix' =&gt; 'before now',\n    'id' =&gt; 22\n);\n\n\/\/prints relative date for post with ID 22 as \"X days before now\"\nthe_relative_date($params);&lt;h3&gt;Relative Time&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>The template tags will return the time relative to the timezone set in Wordpress' General Settings and will return the largest time period that it can, unless the $period parameter is set. If the $period parameter is set, but the post wasn't posted at least 1 $period ago, the template tag will return the largest time period that it can calculate for the post.<\/p>\n\n<p>Acceptable <code>'period'<\/code> values (the returned string will be de-pluralized if needed):<\/p>\n\n<ul>\n<li><code>'seconds'<\/code><\/li>\n<li><code>'minutes'<\/code><\/li>\n<li><code>'hours'<\/code><\/li>\n<li><code>'days'<\/code><\/li>\n<li><code>'weeks'<\/code><\/li>\n<li><code>'months'<\/code><\/li>\n<li><code>'years'<\/code><\/li>\n<li><code>'decades'<\/code><\/li>\n<li><code>'centuries'<\/code><\/li>\n<li><code>'millenia'<\/code><\/li>\n<\/ul>\n\n<h3>Support<\/h3>\n\n<p>Please use the Plug-in's <a href=\"https:\/\/github.com\/ericrallen\/wp-relative-date-template-tag\/issues\">github page<\/a> for reporting any issues or asking questions.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>wp-relative-date-template-tag<\/code> to your plug-in directory or install it from the Wordpress Plug-in Repository<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Change <code>the_date()<\/code> to the <code>the_relative_date()<\/code> wherever you would prefer the relative date to show up<\/li>\n<\/ol>\n\n<!--section=faq-->\n<p>Please use the Plug-in's <a href=\"https:\/\/github.com\/ericrallen\/wp-relative-date-template-tag\/issues\">github page<\/a> for more information<\/p>\n\n<!--section=changelog-->\n<h4>1.0.5<\/h4>\n\n<ul>\n<li>Updated de-pluralize function to work correctly.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>First Release. Switched parameters to be an array instead of explicitly-defined parameters to make it easier for developers to only pass the values they need.<\/li>\n<\/ul>\n\n<h4>0.0.1<\/h4>\n\n<ul>\n<li>Initial set up. Getting it ready for the WP Plug-in repo and github duality.<\/li>\n<\/ul>","raw_excerpt":"Gives developers two template tags for retrieving a relative date instead of an exact date for posts.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/22687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=22687"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/ericrallen"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=22687"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=22687"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=22687"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=22687"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=22687"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=22687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}