Nov17, 2008
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
There are currently 6 approved responses to "Adding a FanUpdate Entry Word Count".
-
I don't get the point of word count in blog entries. It's doesn't even look "cool".
-
Don't ask me, I'm just doing as I'm told ;)
-
Thanks for this Jem, it was very useful. :)
-
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. -
Thanks for that Jem, I'll bookmark this entry for later ^_^
-
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.
Welcome to the blog of girl geek & php ninja; Jem. Web developer, mum and crazy cat lady talks about parenting, pets and php 







