Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
add_shortcode( 'word_count', 'word_count' );
function word_count() {
return sprintf( __( '%s words', 'text-domain' ), str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ), 0 ) );
}
add_filter( 'genesis_post_info', 'custom_post_info_filter' );
function custom_post_info_filter( $post_info ) {
if ( is_singular( 'post' ) ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit] [word_count]';
}
return $post_info;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment