Weighted Words

This plugin creates a weighted list of commonly-used words in your blog posts. Works for WordPress versions 1.5 and up. It’s not just another keyword cloud, though – it pulls words from the text of your posts to expose your embarassing Valley Girl reliance on things like “totally” and “awesome”. Licensed under the GPL.

Current version: 1.2 – download it here!

Instructions

  1. Upload weighted_words.php to your plugin directory.
  2. Activate the plugin.
  3. Edit your template file(s). Place the following function where you want the list to appear:

    weighted_words($mincount, $minlength, $minfont, $maxfont, $unit, $scaling)

    $mincount: Minimum number of times a word must have been used before appearing in the list, default is 25
    $minlength: Minimum word length, default is 3
    $minfont: Minimum font size (%), default is 8
    $maxfont: Maximum font size (%), default is 22
    $unit: Unit for fonz sizes, default is pt
    $scaling: How the font sizes are distributed between the max and min values. 0 for logarithmic scaling, 1 for linear, default is linear. If you want a more even-looking distribution of sizes, try switching to log scaling. Thanks to Uwe Kadritzke for the idea and code.

    The output is enclosed by <p class="weightedwordlist"></p>.

  4. Optional Configuration Steps

  5. If you have pretty permalinks enabled, and you want to use a prettier search URL, look in weighted_words.php for these lines:

    // Edit this string to change your search URL.
    echo '/index.php?s=' . $word . '&submit=ww';

    Change to:
    echo '/search/' . $word ;
  6. Change the list of “noise” words that will not be counted. Look in weighted_words.php for these lines:

    // Remove words that don't matter--"stop words."
    // Edit this list as needed.
    $overusedwords = array( '', 'a', 'am', ...

    and add or remove list entries as needed.

Frequently Asked Questions

Does Weighted Words work with multiple-author blogs?

When used on a multiple-author blog, Weighted Words will count words in posts from all authors. There is currently no way to count posts from a specified author only.

Help! My umlauts are garbled!

The good news is, you’re not alone. Although Weighted Words seems to work fine for accented characters in Italian, it explodes on umlauts and Ã…s; this problem has been reported by several German and Swedish users. The bad news is, I have no idea how to fix it. Sorry.

I added the code, but nothing shows up!

First, view the HTML source of your page: Does <p class="weightedwordlist"> appear? If it does, try decreasing the value of $mincount. You may not have written enough to have used any words more than 25 times.

If you can’t help me, who can?

There’s a Weighted Words thread in the WordPress support forums with some handy advice.

Other Versions