Skip to content

Instantly share code, notes, and snippets.

@MatRouault
Created July 27, 2016 15:10
Show Gist options
  • Save MatRouault/ebb974efb79444d20f465344ac8ac698 to your computer and use it in GitHub Desktop.
Save MatRouault/ebb974efb79444d20f465344ac8ac698 to your computer and use it in GitHub Desktop.
Change the post meta date/time to human difference format.
<?php
//https://community.getbeans.io/discussion/pretty-date/#post-1975
// Change the post meta date prefix.
add_filter( 'beans_post_meta_date_prefix_output', 'example_post_meta_date_prefix' );
function example_post_meta_date_prefix() {
echo 'Posted: ';
}
// Change the post meta date/time to human difference format.
add_filter( 'beans_post_meta_date_text_output', 'example_post_meta_date_text' );
function example_post_meta_date_text() {
echo human_time_diff( get_the_time( 'U' ) ) . ' ago';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment