Created
November 22, 2018 15:28
-
-
Save sh-sabbir/33592af01bd65daf8edeee540e5ecb64 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
<?php | |
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