• I’ve updated the Weighted Words plugin, version 1.1 is now available for download here.

    This release fixes a validation problem with the default search URLs, adds ! to the list of stripped-out punctuation, and adds an option to use “pretty” search URLs.

    There are still character encoding problems. What I think is happening is that strtolower() is ruining everything, and using mb_strtolower() would be the most robust way to fix it. However, my server doesn’t have multibyte string functions installed. If someone could help me test this, I would be much obliged.

Viewing 15 replies - 1 through 15 (of 32 total)
  • It seems like a great plugin but I have no clue how to install it.

    1. Uploaded the file in the Plugin folder > Yes, done
    2. Activated the Plugin > Yes, done
    3. Edit the template and add the code.Place the following function where you want the list to appear:

    I placed in my sidebar.php or is that wrong?

    ———————————-
    weighted_words($mincount, $minlength, $minfont, $maxfont)
    $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 50
    $maxfont: Maximum font size (%), default is 250

    ———————————-

    4. The output is enclosed by <p class=”weightedwordlist”>.

    Q. Where do I add these tags.

    Right now I added the code in 3 & 4 to my sidebar.php and all I see is .. The code:) so I do something terribly wrong.
    See my result on https://www.chinasnippets.com/blog

    Please enlighten me.

    Thanks a lot

    @chinaman: if you’re happy with the default values, you can just add <?php weighted_words(); ?> in your sidebar.php.

    If you want to, you can change the values: for example, if I wanted these values $mincount = 20, $minlength = 5 , $minfont = 80%, $maxfont = 300%, I would add <?php weighted_words(20,5,80,300); ?> to my sidebar.php.

    The words starting with $ are the function’s parametres and they have to be in the same order as the function writer has defined. The definition in this case is on the plugin page under “Usage”.

    The Codex has info about passing parametres to WP template tags and it applies to plugin functions as well.

    As to your question on step 4. The plugin adds the <p class="weightedwordlist"> around its output (at least it should), you don’t have to add it yourself. With the help of the class you can style the list in your style.css.

    Hello. Would it be possible for me to modify this plug-in to get the weighted words from 1 category, rather than all posts?

    I’m looking in the weighted-words.php and considering if this line (or anything else) could be modified to call posts from 1 certain category ID?
    $postcontents = $wpdb->get_results("SELECT post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_date < '$now'");

    … AND category_ID=3 ?? I am new at PHP. ??

    Minna, thanks for the explanation. I do understand more now.

    1. The plugin is uploaded in the plugin folder
    2. The Plugin is activated
    3. I have added – <?php weighted_words(); ?> – to my sidebar.php
    4. I have uploaded the new sidebar
    5. In the code I see that the output is enclosed by <p class=”weightedwordlist”>.
    6. Unfortunately I see no nicely weighted words.

    I guess I am still doing something wrong. But what. Any additional help very welcome

    @dgold: It’s a bit more complicated than that because the posts table in the database doesn’t have the category id. However, this should work (I did test it):

    $postcontents = $wpdb->get_results("SELECT post_content FROM $wpdb->posts, $wpdb->post2cat WHERE $wpdb->post2cat.post_id = $wpdb->posts.ID AND post_status = 'publish' AND post_date < '$now' AND category_id=2");

    That’s put together with my simplish knowledge of SQL ??

    @chinaman: what if you tried it with a smaller $mincount. You can do that by just putting a number (less than 25 which is the default, for example 5?) inside the parentheses: <?php weighted_words(5); ?>
    I’m suspecting it might not work because you have so few posts in the test blog of yours and it requires 25 occurances (as the default) of a word before it shows up.

    Wow, Minna, it worked (I think). Thank you!

    @dgold: I’m glad to hear it ?? I tried changing the category number and it did change the results.
    I’m even tempted to hack a version of the plugin where the category ID can be given as a parametre ?? But maybe we’ll leave it to the plugin author. I often make my own versions of simple plugins (just to my own use, of course!) by adding them to the my-hacks.php file.

    The plug-in is now analyzing which bands I play most-frequently on my radio show, by pulling weighted-words from my Setlists category. Better action, for me, than other “tag cloud” type plugins I’ve seen that mainly showed category names.

    Minna, another “Wow”. It works and I have added it to the real version of chinasnippets.com Great, thanks a lot. Later on I will try including Dgold’s version which is a nice hack.
    I am happy man. Time to sleep.

    Thread Starter yami

    (@yami)

    The plugin author is, alas, too busy for the forseeable to incorporate any of your fabulous hacks – I might get round to it in, um, winter, maybe. So don’t hold back hacks on my account ??

    This is an awesome plugin!

    Thanks for it.

    It did take me a long time but finally YES !!!! its up and working … love this thing … just makes me want to click on it all the time .

    Just wanted to say thank you — “thank you ”

    https://www.barganews.com/daily/

    ciao
    db

    P.S is there a the same kind of plugin around for images ?

    I have this plugin running in the sidebar of https://dgold.info/radio/

    Question… How can I change it to display the words in, let’s say Random order (or for a fun challenge, in order of weight with the big words first), instead of alphabetically? Here’s the line in the plugin code I found –

    // Sort the keys alphabetically.
    ksort( $a );

    Can I change this? To what, for random sort?

    ((deleted, this post appeared twice))

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Weighted Words 1.1’ is closed to new replies.