erictherobot
5/5/2015 - 6:55 AM

more_human_time_diff.php

										<?php
											$last_modified = human_time_diff( the_modified_date('U','','', false), current_time('timestamp') );
											$number_of_x = preg_replace('/[^0-9]*/', '', $last_modified);
											if ( strpos( $last_modified, 'min' ) || strpos( $last_modified, 'hour' ) || strpos($last_modified, 'sec' ) ) {
												$wiki_date = $last_modified;
											} elseif (  $number_of_x > 365 ) {
												$wiki_date = __( 'a long time' );
											} elseif ( $number_of_x >= 180 ) {
												$wiki_date = __( 'less than a year' );
											} elseif ( $number_of_x >= 60 ) {
												$wiki_date = __( 'a couple months' );
											} elseif ( $number_of_x >= 30 ) {
												$wiki_date = __( 'a month' );
											} elseif ( $number_of_x >= 14 ) {
												$wiki_date = __( 'a couple weeks' );
											} elseif ( $number_of_x >= 7 ) {
												$wiki_date = __( 'a week' );
											} elseif ( ( $number_of_x <= 3 ) && ( $number_of_x > 1 ) ) {
												$wiki_date = __( 'a couple days' );
											} else {
												$wiki_date = human_time_diff( the_modified_date('U','','', false), current_time('timestamp') );
											} ?>
										<?php echo sprintf( __( 'Last updated %s ago' ), $wiki_date ); ?>