/* Change Post Date Format (Ago) */
function jnews_ago_time( $post = null ) {
$publish_date = human_time_diff( get_post_timestamp($post, 'date'), current_time( 'timestamp' ) );
$modified_date = human_time_diff( get_post_timestamp($post, 'modified'), current_time( 'timestamp' ) );
if ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'publish' ) {
return esc_html(
sprintf(
jnews_return_translation( '%s ago', 'jnews', 'sago' ),
$publish_date
)
);
} elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'both' ) {
return esc_html(
sprintf(
jnews_return_translation( 'Published %s ago, Modified %s ago', 'jnews', 'sagoboth' ),
$publish_date, $modified_date
)
);
} elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'modified' ) {
return esc_html(
sprintf(
jnews_return_translation( '%s ago', 'jnews', 'sago' ),
$modified_date
)
);
}
}