Created
November 22, 2017 11:47
-
-
Save nschaeferhoff/41b2b2466117b12bd9b53f6e154af76c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function reading_time() { | |
$content = get_post_field( 'post_content', $post->ID ); | |
$word_count = str_word_count( strip_tags( $content ) ); | |
$readingtime = ceil($word_count / 200); | |
if ($readingtime == 1) { | |
$timer = " minute"; | |
} else { | |
$timer = " minutes"; | |
} | |
$totalreadingtime = $readingtime . $timer; | |
return $totalreadingtime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment