Created
June 24, 2015 13:18
-
-
Save georgiecel/14c43aa3b6b8913d5481 to your computer and use it in GitHub Desktop.
word count for WordPress post, use <?php echo wordcount(); ?> in the post loop
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 wordcount() { | |
ob_start(); | |
the_content(); | |
$postcontent = ob_get_clean(); | |
return sizeof(explode(" ", $postcontent)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment