If you are a numbers’ guy and would like to display the word count of all you blog posts, there is an easy way to do that. You just need to create a new function in the functions.php file of your own WordPress theme by pasting the following code:
1 2 3 4 5 6 7 8 9 10 11
function wordcount(){
ob_start();
the_content();
$postcontent = ob_get_clean();
return sizeof(explode(" ", $postcontent));
}Then you need to call the function where you want to display the word count of your posts (for example in your single.php file), by pasting the following code within the loop:
1
<?php echo wordcount(); ?>

What if you’re a numbers gal? ;) haha just messing around with you, this is super helpful! For guys and gals alike!
LOL @ numbers gal haha me too!
Again I am stealing this coolness for my WordPress. Thanks a ton, man!
So this will display the word count to the readers publicly? Or just when I type it out? I definitely do think that could come in handy.. I love the feeling of getting lost while writing and being totally shocked by the word total. It makes me feel like I got a lot accomplished :)
It looks like we will just have to apply it and find out!
This looks pretty cool! I wonder what it will look like.. I’m gonna try it!
These are some neat tricks that you post on here, I think it comes very much in handy for anyone who has a wordpress site. Very cool of you to post these.
I’m definitely applying this to my site. Word count is always a useful figure to measure yourself by.
It seems to be very simple to do. Thank you so much for sharing it, I will definitely check it out
I’m not sure why readers would care about the word count- are they going to be particularly impressed by it? Either way, this is a cool gadget, and it couldn’t hurt to apply it and see the readers’ reactions.
It definitely couldn’t hurt to have another figure listed, something that could draw a reaction from readers, or something that you yourself can use to analyze your success rate i.e. do posts with higher word counts get more attention or something like that.