I wanted this too, so here’s what I did:
I used to use Rodin as my blogging tool and that has taught me a lot over the last year and a half. Rodin counts words and I just took that code and put it into WordPress.
I opened edit-form-advanced.php
and found the beginning of the textarea
where the post content is displayed. Here’s what you are looking for:
<?php the_quicktags(); ?>
<div><textarea <?php if...
Right after that DIV, paste this:
<?php
$post->post_content = preg_replace('/s+/', ' ', strip_tags($post->post_content)); // remove white space and html
$words = ((count(explode(" ",$post->post_content)) + count(explode(".r",$post->post_content)))-1); // count spaces and periods
if ($words == 1)
{
echo "<p class="note">Post length: ~ $words word
";
}
else
{
echo "<p class="note">Post length: ~ $words words
";
}
?>
I only use the advanced screen, but I’m sure this would work just fine in edit-form.php
if you’re using the visual rich editor. Open that file and search for textarea
and you’ll find the spot. Again, right after the DIV, paste the above code.
Now, you just have to remember that you changed that file next time you upgrade. Anyone have an idea how to make this more streamlined?