Adding a FanUpdate Entry Word Count
This is a rough 30-second guide, code is short & sweet, and I've not run the mod past Jenny... but, I'm not one to refuse a request when it's simple to implement.
In your fanupdate folder (or the root of your website if that's where you've got it installed), open the class folder, and find FanUpdate_Post.php.
Right near the very bottom of the file, look for:
$text = str_replace('{{body}}', $this->getBodyFormatted(), $text);
On a new line right after that one, add:
$text = str_replace('{{word_count}}', str_word_count($this->getBody()), $text);
Now, in your blog control panel, go to Options -> Templates, and in the entry_template: box put {{word_count}} where you'd like the word count to appear. E.g. on a default install, I edited the following line:
<p class="catfile">Posted {{date}}. Filed under {{category}}. {{comment_link}}. Word Count: {{word_count}}</p>
Save your settings and refresh your blog, it should appear exactly where you placed it.
Comments (6)
Leave a Comment
No HTML (it will be stripped); first time comments are moderated; comments left without a legitimate first name/nickname and e-mail will be deleted (no, your momma didn't call you "cheap quality wardrobes").




On Mon 17th Nov 2008 @ 20:24, Julia said:
I don't get the point of word count in blog entries. It's doesn't even look "cool".
On Mon 17th Nov 2008 @ 20:31, Jem said:
Don't ask me, I'm just doing as I'm told
On Mon 17th Nov 2008 @ 20:35, Kim said:
Thanks for this Jem, it was very useful.
On Mon 17th Nov 2008 @ 20:37, Kim said:
Damn, clicked submit before I was finished. =/
Also wanted to say:
I tested it out and it worked... Not that I'll probably keep it but it was useful to play with.
On Tue 18th Nov 2008 @ 01:35, Alexandra said:
Thanks for that Jem, I'll bookmark this entry for later ^_^
On Tue 18th Nov 2008 @ 04:31, Julia said:
Thanks for this, I doubt I'll ever use it. I want to try it out but my site is down
It probably is 30secs.