I’m proud to present my first WordPress plugin, Words in Post. All it does is count up the number of the words in a post and spit them out. By sticking this code in the index.php template of WordPress, I can create a title line that looks like this:
Geekery ï¿½ 49 words ï¿½ lee @ 2:50 am
This is better than using the following simple grab that I had heard about here.
<?php echo(str_word_count(get_the_content())); ?> words
The preceding doesn’t grab anything past the
<!--more--> and counts tags incorrectly.
Thanks to Nick Momrik for the inspiration.
1-15-05 update: Version 1.1. Thanks to Alderete’s suggestion, the function returns a number instead of echoing. See the php for instructions.
Download Words in Post plugin version 1.1 here. Rename it from .phps to .php and run with it.