Code: Word Count

Update: This function is now built into WordPress 2.6. Consider NOT downloading this plugin, unless you just want to see how it does its thing. I do not know if this works in 2.6+.

Word Count 1.0 WordPress Plugin
Download: wordcount.zip

Description: Plugin to display the word count of posts while editing. HTML will not be counted in this so the number displayed is an honest count of the amount of words used in an entry.
Screenshot:
Credit: Based heavily on Word Statistics by John Watson.
Installation:

  1. Unzip;
  2. Upload wordcount.php to wp-content/plugins;
  3. Activate Word Count 1.0 through the ‘Plugins’ menu.
Compatibility: WordPress 2.0, 2.1, and 2.2

17 comments

1. Law Vibe says:

[7/25/2007 - 8:02 pm]

Finally I find a word count plugin! What updates are planned?

2. Todd says:

[7/26/2007 - 8:13 am]

Er… what updates do you need? There’s nothing planned right now. Do you see the need for something?

3. Law Vibe says:

[8/14/2007 - 12:56 pm]

1.Have the link in the plugin menu under wordpress admin point to this particular page. I couldn’t get to it from toddseal.com. Maybe have the link Word Count under ‘Plugin’ lead to this page and the link you have under ‘description’ lead to toddseal.com

2.Is there a way to not count smilies? As in :) :(

Thanks!

4. Todd says:

[8/14/2007 - 3:07 pm]

1. Done. I’ll upload 1.1 soon enough. Since those are not functionality issues, I’m not worried about getting a fix up here fast. They are good points, though, and I’m glad you called them to my attention.

2. If actual emoticons are activated (Options >> Writing >> Convert emoticons…), those are already not counted with this plugin. If you want to exclude non-graphic smilies from the word count (those relying only on punctuation marks), that’s a bit tougher. I just spent the last hour or so working on it to no avail. My idea is to remove all punctuation marks (with only a few exceptions) and add a blank space in their place. Since this plugin doesn’t count blank space, this should solve the problem. Well, it doesn’t and I’m not sure why. I tried something I saw on the PHP site, but that didn’t work, either. I’ll work on that more. If anyone else has any ideas, let me know.

Thanks, Law Vibe. If you have other suggestions, I’m open to them.

5. Patrick D. says:

[8/15/2007 - 8:08 pm]

Very cool plugin. Kudos to you, sir!

6. tom says:

[9/14/2007 - 11:21 am]

hi,

love your plugin really. what about an ajax based counting? everytime you enter your text and stop for 1 or 2 seconds the counter could update itself so you could see how many words you have wrote. it shouldn’t update permanently i think cause it could irritate the writer but always hit the save buttons i think could be a bit annoying for a while.

keep up good work.

7. Mike says:

[9/25/2007 - 6:21 pm]

Ajax option would be amazing – very useful as it is but that would bump this up to superstar status.

Any word on compatibility with v2.3 of wordpress?

8. Todd says:

[9/28/2007 - 10:54 am]

If I can figure out how 2.3 changes mean I need to recode this, I’ll do it. Anyone have suggestions? Can anyone tell me for sure that this does not work in 2.3?

Ajax sounds like a good idea and that could be really cool, but that’s not my specialty. I’ll keep it in the back of my head. Just don’t hold your breath on it.

Keep ‘em comin’!

9. SeoTier says:

[10/5/2007 - 7:58 am]

Great plugin! I’ve been cracking my head trying to look for this sort of plugin.

Btw, I also would like to see an ajaxed based counting.

Or maybe a quicktag button that updates the word count of the post. We only have to click the quicktag button to update to the current word count without leaving the page or having to save a page for the word count to update.

10. Tim says:

[10/8/2007 - 9:35 am]

I have v2.3 and it seems to work fine.

I agree than AJAX counting would be very nice. Having to save each time to get a count is a little frustrating.

VERY nice plugin though!

11. Kristan says:

[3/13/2008 - 7:03 pm]

Thanks for this! My only suggestion would be to move the display of the word count to someplace else, like right underneath the post box (before the Tags). I actually modified it myself to be grey text and sit underneath “Post” instead of “Title.” But I never in a million years would have known how to write the whole plugin, so thank you very, very much!

12. Mike Legal says:

[3/29/2008 - 1:25 pm]

Any word on an update?

13. Mike Legal says:

[3/29/2008 - 1:27 pm]

p.s. Confirmed that plugin is NOT working on v2.5

14. Mike Legal says:

[3/29/2008 - 1:29 pm]

oops it IS working in 2.5!

15. Michael says:

[3/30/2008 - 10:15 am]

Can you make this “live” using scrips from http://trac.wordpress.org/ticket/4807 ?

16. Todd says:

[3/30/2008 - 10:31 am]

I’m not planning to update this plugin. It’s simply not a high priority for me and I’m not seeing anything that’s a pressing update.

It looks like the plugin works, but AJAX would make it more convenient. While the AJAX idea is an interesting one, that would involve a complete overhaul of the plugin. The current version gets its word count from info entered into the database, so saving the page is the only way to update the count as far as I know.

Glad to know this works in version 2.5, Mike.

Not sure what you mean by “live,” Michael.

17. Michael says:

[3/30/2008 - 10:44 am]

I meant “count as you write” like that patch which does not work in 2.5 and they aren’t willing to update.

Add Your Comment - Join the Fun!




Comment: