WP plugin: Category Word Count
In regards to my upcoming November writing project, I’ll be tracking word count for my story offline, but also wanted an automated running total in WordPress of all posts in the novel’s category (in other words, the novel). It was something I had in Movable Type last year through use of a plugin. There are several plugins and hacks for WordPress that provide word count on a per-post or site-wide basis, but nothing I found that worked specifically on categories.
So I wrote one. Naturally.
To use Category Word Count, download the zip file, extract cat-word-count.php from it, and drop that in your /wp-content/plugins folder.
Once it’s activated in WordPress, you can call it from your WordPress template using the
cat_word_count() function. For example:
<?php cat_word_count(); ?>
Which returns something like:
Deep Thoughts word count: 4,560
It accepts two arguments; the first is the numerical id for a category (this defaults to the current category when on a category page), and the second is for the prefatory text (default is shown above):
<?php cat_word_count('2', 'A lot of words: '); ?>
And so, that’s one less thing for me to think about this November.
cat_word_count()or the URL query, all categories are counted. In other words, it then duplicates Nick Momrik’s most excellent Post Word Count plugin (Sorry Nick, it couldn’t be helped). That is all.