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.

Tagged .

Comments

There are currently 6 approved responses to "Adding a FanUpdate Entry Word Count".

  1. [gravatar]

    Julia 17/11/08 at 20:24 #

    I don't get the point of word count in blog entries. It's doesn't even look "cool".

  2. [gravatar]

    Jem 17/11/08 at 20:31 #

    Don't ask me, I'm just doing as I'm told ;)

  3. [gravatar]

    Kim 17/11/08 at 20:35 #

    Thanks for this Jem, it was very useful. :)

  4. [gravatar]

    Kim 17/11/08 at 20:37 #

    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.

  5. [gravatar]

    Alexandra 18/11/08 at 01:35 #

    Thanks for that Jem, I'll bookmark this entry for later ^_^

  6. [gravatar]

    Julia 18/11/08 at 04:31 #

    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.

Comments are closed.