Comments for Word count plugin for Movable Type

Excerpt: MTWordCount is a Movable Type plugin that counts your entry’s words and inserts it into your page. Version 1.4 includes an image count for photo blogs. Read the whole article…

The One True b!X
June 30, 2002 2:27 AM

Eek, what is this, seen after rebuilding my Dailies. I didn't get it when I rebuilt my Main Index, tho. Your Daily pages have been rebuilt. View your site. MT::App::CMS=HASH(0x140f18) Use of uninitialized value in split at plugins/ line 9. MT::App::CMS=HASH(0x140f18) Use of uninitialized value in split at plugins/ line 9. MT::App::CMS=HASH(0x140f18) Use of uninitialized value in split at plugins/ line 9. MT::App::CMS=HASH(0x140f18) Use of uninitialized value in split at plugins/ line 9.

The One True b!X
June 30, 2002 2:19 PM

Nevermind. It is doing it on Daily Monthly and Index rebuilds. I'm fairly certain it's because I don't always have Extended Entry text. But nothing fails, it just spits out that debugging message, so it's not a big deal, heh.

Adam Kalsey
June 30, 2002 9:37 PM

That's a bug. I've made some changes and uploaded a new version of the plugin. That message should be gone now.

July 3, 2002 10:48 AM

what about counting all of the words under a particular category? or all of the words in your entire weblog? i used to export ALL of my entries into one huge file (>1 Mb), open it in a text editor, strip out the HTML tags, word count it and then manually type this number onto my page. i stopped doing it as it was labour intensive and rebuilding the huge file caused other lags on my site (when posting comments, etc). is it possible to have a plug-in that will track all of your entries, update the total word count and then paste the updated value on your site? now that would be nice...

Adam Kalsey
July 3, 2002 11:00 AM

Well, you could do something like this to get a word count of your entire weblog. Create a new index template called wordcount.js that contains: <script> var count = 0; <MTEntries lastn="10000"> count += <MTWordCount>; </MTEntries> document.write(count); </script> Then just place <script src="wordcount.js"> in your page where you want the count to appear. You could do the same thing for a category by changing the MTEntries tag to include a category restriction.

July 3, 2002 11:38 AM

the word counting worked (it generated a wordcount.js file with a bunch of fun code in it), but when i place the on my page, it does not display any text at all...

July 3, 2002 11:39 AM

sorry, the comments cut out my code example. i meant when i place the script=wordcount.js tag on my page, it does not display any text.

Adam Kalsey
July 3, 2002 12:17 PM

Okay, on second thought, maybe I should have tested the Javascript before I posted it... The template that uses the wordcount plugin should not have the <script> or </script> lines in it. And to insert the count into your page, you want to use <script src="wordcount.js"></script> This one is tested and should work fine.

July 3, 2002 3:10 PM

adam, you are the man. seriously. it works like a charm. thanks very much.

July 3, 2002 6:47 PM

It'd be cool if you could put it in the master archive index (sidebar). Then you could see which of the last few entries were large enough to be worth reading. Right now when I rebuild I get: Can't call method "text" on an undefined value at plugins\ line 18.

Adam Kalsey
July 3, 2002 7:10 PM

It sounds like you are placing MTWordCount in your archive sidebar. MTWordCount has to be placed inside of <MTEntries>.

July 8, 2002 9:03 PM

It works great--thanks!

July 14, 2002 1:45 AM

If you look at my site, I get nothing. Word Count: [There is nothing here] I have it installed in: /cgi-bin/mt/plugins/ Permissions are 755..any ideas? Oh and when I upgraded to 2.21 it still shows 2.2, could that be part of the problem?

Adam Kalsey
July 14, 2002 9:50 AM

If you've upgraded the 2.21 and your version still shows 2.2, then there's something wrong. At least one of your files didn't get upgraded. Try performing the upgrade again. Do you get any error messages when you rebuild? Another thing that could have happened is your computer could have converted the plugin file to Windows or Mac format. Try downloading the plugin again and then upload it to your server without opening it on your computer first.

July 14, 2002 12:55 PM

I redownloaded the upgrade tar.gz file, and it still shows 2.2, no error messages tho.. Hmm

Adam Kalsey
July 14, 2002 1:22 PM

You should probably ask about that on the MT support board.

July 15, 2002 2:34 PM

I think I will, but I still get nothing from your plugin.. no errors, no nothing

Adam Kalsey
July 15, 2002 3:05 PM

Trying to troubleshoot a plugin while MT isn't running properly is likely to be a futile excercise. The version number in MT is generated by MT, so it should come up correct if MT is properly installed.

July 15, 2002 9:20 PM

Ignore everything. See the last post by "alf2org" in the mt forum:;act=ST;f=10;t=1013 Sorry I took up your time!

August 9, 2002 2:33 AM

Just a tip for WordCount users (stole it from DiveIntoMark) change your RDF template: <MTEntries lastn="15"> <item rdf:about="<$MTEntryLink$>"> <title><$MTEntryTitle encode_xml="1"$></title> <description>In <$MTWordCount$> words: <$MTEntryExcerpt encode_xml="1"$></description> Newsfeed aggregators will show how large the entry is, besides the excerpt

August 31, 2002 8:48 AM

Adam, you know I use this macro and I like it very much. Would it be possible to write a macro which counts images? I have some additional entrys with only a few words but a number of pictures. I would like a link to "More... (xxx words, x pics)"

Adam Kalsey
August 31, 2002 5:47 PM

Sure. Download the latest version of the WordCount plugin. It now counts images with a MTImageCount tag. While I was at it, I made the whole thing run quite a bit faster as well.

August 31, 2002 6:21 PM

Wow, that was quick! And it works really good. I'm glad you thought it an interesting addition as well! Thanks

September 9, 2002 1:22 PM

It's embarrassing, but I have to ask: what could be going wrong for me? I want to count all words written in my blog, so I followed the steps to create a wordcount.js template, inserted the code (I actually took Pat's code from his page and changed the path because I wanted to make sure I got the JavaScript language right), rebuilt, and...nothing. I'm using 2.21, and other JavaScript widgets are working for me - could you please give me some suggestions on what I might troubleshoot? Thank you!

Adam Kalsey
September 9, 2002 1:29 PM

Did you install the WordCount plugin? The JavaScript won't do anything without it. The URL of your Javascript file might help as well. Then I could look and see what's in it.

September 9, 2002 3:24 PM

Yep, in fact I just reinstalled, just to be sure. The plugin is in my plugins folder in the MT directory, CHMODed to 755 (folder is also 755) . The wordcount.js file is at and the index page souce code shows the Javascript language in the Archives section of the sidebar. Thank you for looking!

Adam Kalsey
September 9, 2002 3:30 PM

Your HTML code shows that you are using src="home/nammer/public_html/wordcount.js" as your script. Unless you have something at then that won't work. You'll want to change that line to say src="/wordcount.js" In HTML, you refer to JavaScript src files in the same way as you refer to image or CSS sources. Use the path of your Web server, not the complete file path of your host.

September 9, 2002 3:49 PM

Ah, perfect - I'm so glad it was so easily fixed - thanks for the path tutorial - I've jotted it down for future reference!

October 10, 2002 1:22 AM

Love the WordCount plugin. I installed it yesterday, including the wordcount total, and it worked like a charm except that I found it slowed down my rebuild massively (see MT support forum thread below), probably because I have over 1250 entries, so I had to un-install it. :-(;act=ST;f=8;t=8838 Debbie

Adam Kalsey
October 10, 2002 12:06 PM

Wordcount should be lightning quick. All it does is grabs the text of the entry and performs one very fast regex on it to determine how many words there are. My bet is that using the total site Wordcount is slowing things down. When you use that, Movable Type has to load all of the entries in your Weblog. That's going to take some time with 1250 entries.

Brian Peace
November 5, 2002 8:17 AM

I installed the word count plugin on my NaNoWriMo site and it works like a charm on every page. I installed it on a friend's blog with the Category restriction and it works fine on the index page, but the Word Count Total does not work in the Category or Date-Based archives.

Adam Kalsey
November 5, 2002 8:58 AM

Change your javascript on the archive pages to /surfing/wordcount.js

Brian Peace
November 6, 2002 1:12 PM

Thanks. Doh!

Chris Hileman
November 10, 2002 12:45 AM

I have instructions for how to do the entire blog word count in PHP for those who don't have JS enabled or something. Pretty simple. I would have psted the code here but it doesn't like me ;-).

Roger L. Waggener
November 10, 2002 2:14 PM

I'm also using the wordcount plugin on my NaNoWriMo page but the count seems to be robbing me of some words. The Section 1 count shows 1696, but when I cut n' paste the text into a text editor and hit the text statistics button, it says 1720. I've also verified this effect by using 'wc -w' on a file of just the text on my Unix system at work. The number is about 35 words short for the Section 2 count, measured the same way. Do you have any idea what I might be doing wrong?

Adam Kalsey
November 10, 2002 7:45 PM

The plugin sometimes doesn't see the last word in a paragraph. You can fix this by changing the line that reads my $count = $strText =~ s/((^|\s)\S)/$1/ig; to say my $count = $strText =~ s/((^|\s|$)\S)/$1/ig;

Roger L. Waggener
November 14, 2002 11:15 AM

Thanks for the RegEx fix advice- and Thanks for this cool plugin

January 3, 2003 4:27 PM

Hi, everyone! i installed the script, but the he only counts the entry words not the extended ones, any idea? see Many thanks

Adam Kalsey
January 3, 2003 4:45 PM

Try creating a test with a longer extended entry, With only one or two words in the extended entry it's hard to see if there really is a problem. Try putting 10-20 words in both the entry body and the extended entry.

January 3, 2003 4:53 PM

i got that... check the 1st post please. only 2 words :( regards, Daksider

January 3, 2003 4:55 PM

(1 <- wordcount) palavras escritas, por Darksider s 04:34

January 3, 2003 4:59 PM

ops its works now! wierd? how its possible to work in this new entry and not in the others?!

Adam Kalsey
January 3, 2003 4:59 PM

What I need you to do is create an entry with a longer entry body and extended entry. There's a known bug where the plugin won't always count the last word in a paragraph. Since your paragraphs only contain one or two words, there's no way to tell if the plugin is counting the extended entry.

January 3, 2003 5:24 PM

thanks for the very fast support :)

Kymberlie R. McGuire
January 4, 2003 2:18 AM

Excellent plugin and thanks for the javascript for total word count. I have them both implemented on my blog. :-)

Trackback from
February 19, 2003 3:01 PM

word count

Excerpt: eigentlich msste ich ja noch ein wenig schuften, aber ich mag nicht mehr, daher habe ich gerade mal noch das

Deane Barker
February 24, 2003 1:48 PM

I did the same thing (total word count) on Look down the bottom of the left sidebar. Works beautifully.

Trackback from Tribblescape Info
March 18, 2003 3:09 PM

Movable Type word count plugin


Trackback from
March 21, 2003 3:21 PM

MTEntryContents 1.0

Excerpt: A flashier alternative to MTWordCount.

April 6, 2003 9:56 PM

now that i've installed this nifty plug-in (thanks so much), how might I go about using the Word Count data to display, say, the five longest entries throughout my blog?

Trackback from Pete's Weblog
May 10, 2003 8:26 AM

Installed WordCount

Excerpt: I've installed the Word count plugin on the site and it's in use on the Farmblog so you can see whether a post is going to take up an hour of your time to read or not. Here's credit where credit is due....

Trackback from Brainstorms and Raves
August 21, 2003 6:17 PM

Follow-up: Movable Type, Perl Upgrades

Excerpt: Today's post is a follow-up to my MT installation woes from last week. I promised to write about what happened and how everything was fixed, as there's not much documentation around about this specific problem.

Trackback from patchwork progression
September 2, 2003 11:45 AM

MT Tweaks

Excerpt: General, indispensible links for MT setup and configuration include: Movable Type, the girlie matters, Empty Pages, Scriptygoddess, and CSS Zen Garden. To minimize the tehno-babble on this blog while keeping track of this behemoth project, here is the ...

September 27, 2003 10:17 AM

I love this plugin! It works perfectly, and you're total weblog count works wonders too, so thank you for that too. The only thing that I wish it had was a method for adding a comma separator as needed. For example, 10,000 verses 10000. Is there anyway to do this, or have I missed something?

Trackback from -Funtime Franky-
October 10, 2003 7:04 AM

In other news today...

Excerpt: Will over at Basingstoke Life has redesigned his site with a Black theme, which while I like the black and white theme, I’m not too sure about the massive image of the Thames. Over here, I have rejigged certain parts...

Trackback from
October 14, 2003 9:32 AM

More Improvements

Excerpt: Some of them are behind the scenes, but there have been a bunch of improvements to the site over the past few days. A thousand thanks to the Six Apart people for making Movable Type, the software behind this site...

Joshu'a M
October 20, 2003 1:26 PM

Is there anyway to incorporate this into mtarchivelist so that the wordcount will show up beside each entry reference?

October 21, 2003 12:23 AM

I'm surprised no one has asked for an option to count JUST the words in the Extended Entry. Been reading through everything in here and EntryCount and haven't found anything that indicates that either plugin could do it. Did I miss something? Or if I didn't... any chance it could be added? Thanks

October 22, 2003 11:00 AM

I am getting a similar error (as reported Jun 30, 2002) with other MT plugins. Could you please specify how you got around the problem ? MT::App::CMS=HASH(0x140f18) Use of uninitialized value in split at plugins

October 26, 2003 5:12 PM

I'm trying to figure out how to limit the word count to just one category, or to do it by categories instead of on each individual entry. I've looked all over the MT site and MTplugins site, but haven't found the answer, and since I'm relatively new to MT, I'm not sure how to go about it. I got it to count the words for every single one of my entries, but what I would like is to be able to display in the sidebar, by category, the number of words in each category. Can you help me out?

Michael Heraghty
November 8, 2003 6:23 AM

Does this plugin still work for version 2.64?

Trackback from Ones and Zeros
November 13, 2003 9:03 AM

Workin' in a code mine

Excerpt: I created a modified version of MTWordCount that has the property 'exclude' that allows selection of just the Body or just the Extended Entry.

November 13, 2003 9:08 AM

This plugin works fine in 2.63. MegaLion: I also wanted the ability to just get Body or Extended Count. Go to my web page for a link to a modified version. Note: While my code works for me, this is really my first try with Perl. Luckily, this is a small plugin to work on.

Trackback from diachrony
November 19, 2003 5:31 PM

Rambling On

Excerpt: I don’t suppose this has any practical value but I came across a script for totalling the word count of a MovableType blog (which I’ve incorporated into the title bar of both my blogs). The original script was posted by...

Trackback from Mind of Knowledge
December 17, 2003 2:30 PM

MT Word Count

Excerpt: Word count plugin for Movable Type :: Kalsey Consulting Group...

Trackback from chris' introspective
September 28, 2004 2:43 PM


Excerpt: With the shifting of Movable Type templates to dynamic pages, many of the existing Perl plugins won't work (since PHP can't execute Perl). One function I've been waiting to see was the wordcount plugin, however I can't find one. So...

Trackback from Atomkinder Broadcast
October 5, 2004 3:12 PM

Rebuilding EmpireHax

Excerpt: You know it. I know it. Zorak know it. Moltar know it. Rebuilding the Atomkinder news system with MovableType turned into quite a mission. I used a bunch of stuff to do it, here be the record of the process...

This discussion has been closed.

Follow me on Twitter

Best Of

  • How not to apply for a job Applying for a job isn't that hard, but it does take some minimal effort and common sense.
  • Simplified Form Errors One of the most frustrating experiences on the Web is filling out forms. When mistakes are made, the user is often left guessing what they need to correct. We've taken an approach that shows the user in no uncertain terms what needs to be fixed.
  • The best of 2006 I wrote a lot of drivel in 2006. Here's the things that are less crappy than the rest.
  • Rounded corners in CSS There lots of ways to create rounded corners with CSS, but they always require lots of complex HTML and CSS. This is simpler.
  • Debunking predictions Read/Write Web's authors have some goofy predictions.
  • More of the best »

Recently Read

Get More

Subscribe | Archives


Physical camera shutter for Cisco Spark Board (Jul 6)
A 3d printable design for a camera shutter for a Cisco Spark Board
My Travel Coffee Setup (Jan 20)
What my travel coffee brewing setup looks like, and how you can build your own for under $100.
Turkey Legs (May 30)
Product naming gone awry.
Speaking for Geeks: Your Slides (Dec 17)
Tips and tricks for creating great slides.
Speaking for Geeks: Writing Your Talk (Dec 14)
Don’t wait until the night before the talk to write it. Crazy, I know.
Speaking for Geeks: Tell a Story (Dec 13)
Telling a story keeps your presentation focused, keeps your audience interested, and makes it easier for you to remember your talk.
Speaking for Geeks: Where to speak (Dec 11)
You've got a great idea for a talk. How do you find conferences to submit it to?
Speaking for Geeks: Getting your session accepted (Dec 10)
Your conference speaking submissions are not getting accepted because they're bad. Here's how to make them better.

Subscribe to this site's feed.


Voice and communications platforms, including Tropo and Phono. Work.
The Sacramento technology startup community.
Pinewood Freak
Pinewood Derby tips and tricks


Adam Kalsey

Mobile: 916.600.2497

Email: adam AT

AIM or Skype: akalsey



©1999-2017 Adam Kalsey.
Content management by Movable Type.