Created
July 23, 2017 12:19
-
-
Save manhleo93/1199879a21e8ed8947b76d44061adb08 to your computer and use it in GitHub Desktop.
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
// Display Post Word Count in Genesis | |
// Note: Special Thanks to Victor Front: Ref: https://www.facebook.com/groups/genesiswp/permalink/1536463436404848/ | |
// 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; | |
endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment