Skip to content

Instantly share code, notes, and snippets.

Last active June 14, 2017 11:41
What would you like to do?
Display Word Count in Post Info in Genesis
// Display Post Word Count in Genesis
// Note: Special Thanks to Victor Front: Ref:
// And Sridhar:
// Print Post Word Count and Create a Shortcode
add_shortcode( 'word-count', 'post_word_count' );
function post_word_count() {
return sprintf( __( '%s Words', 'leaguewp' ), str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ), 0 ) );
// Customize Post Info in Entry Header and Insert Short Code for Post Word Count
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter( $post_info ) {
if ( is_front_page() || is_archive() ) :
$post_info = '[post_date][word-count][post_comments]';
return $post_info;
elseif (is_single()) :
$post_info = 'By [post_author_posts_link] on [post_date][word-count][post_comments]';
return $post_info;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment