Created
February 6, 2019 10:43
-
-
Save liam-lime/de535e1636757a3b43970a98f4fa8433 to your computer and use it in GitHub Desktop.
WP Filter: Add “time ago” time display at the end of each post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'the_content', 'wpcandy_time_ago' ); | |
function wpcandy_time_ago ( $content ) { | |
$content .= " | |
" . __( 'Posted ', 'wpcandy' ) . human_time_diff( get_the_time('U'), current_time('timestamp') ) . __( ' ago', 'wpcandy' ); | |
return $content; | |
} // End wpcandy_time_ago() | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment