WordPress Question:

Download Job Interview Questions and Answers PDF

How to use time ago function on wordpress posts?

WordPress (CMS) Interview Question
WordPress (CMS) Interview Question

Answers:

Answer #1
<!---------------add code in function.php ------------------>
<?php
add_filter( \'the_content\', \'time_ago\' );

function time_ago ( $content ) {

$content .= \"
\" . __( \'Posted \', \'test\' ) . human_time_diff( get_the_time(\'U\'), current_time(\'timestamp\') ) . __( \' ago\', \'test\' );

return $content;

}
?>

Answer #2
Please remove all '/' this.

Download WordPress (CMS) Interview Questions And Answers PDF

Previous QuestionNext Question
How to create plugin for wordpress?What is WordPress?