WordPress.org

Ready to get started?Download WordPress

Forums

Weighted Words 1.1 (33 posts)

  1. yami
    Member
    Posted 9 years ago #

    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.

  2. chinaman
    Member
    Posted 9 years ago #

    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 http://www.chinasnippets.com/blog

    Please enlighten me.

    Thanks a lot

  3. Minna
    Member
    Posted 9 years ago #

    @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.

  4. Dgold
    Member
    Posted 9 years ago #

    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. :D

  5. chinaman
    Member
    Posted 9 years ago #

    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

  6. Minna
    Member
    Posted 9 years ago #

    @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 :)

  7. Minna
    Member
    Posted 9 years ago #

    @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.

  8. Dgold
    Member
    Posted 9 years ago #

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

  9. Minna
    Member
    Posted 9 years ago #

    @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.

  10. Dgold
    Member
    Posted 9 years ago #

    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.

  11. chinaman
    Member
    Posted 9 years ago #

    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.

  12. yami
    Member
    Posted 9 years ago #

    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 :)

  13. piginzen
    Member
    Posted 9 years ago #

    This is an awesome plugin!

    Thanks for it.

  14. doggybag
    Member
    Posted 8 years ago #

    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 "

    http://www.barganews.com/daily/

    ciao
    db

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

  15. Dgold
    Member
    Posted 8 years ago #

    I have this plugin running in the sidebar of http://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?

  16. Dgold
    Member
    Posted 8 years ago #

    ((deleted, this post appeared twice))

  17. Usayd
    Member
    Posted 8 years ago #

    good plugin thanks

  18. oemmler
    Member
    Posted 8 years ago #

    As i am using Weighted Words for my german blog i get QuestionMarks (?) for all german Charakters Like Ä Ö Ü ... Could anyone tell me where to fix this issue?

    Oliver
    See Result: http://www.oliver-emmler.de

  19. hisyam
    Member
    Posted 8 years ago #

    = Help! My non-English characters are garbled! =

    The good news is, you're not alone. The bad news is, there's no fix for this problem yet.
    It will be addressed in a future version of Weighted Words.

  20. Anne-Marie
    Member
    Posted 8 years ago #

    Just realized that I'm not a genius when it comes to plugins, and again when it comes to this one Im just not getting it.

    I unpacked, uploaded and activated the plugin. Pasted the : <?php weighted_words(); ?> code in my sidebar.php (in my case : <?php weighted_words(5,3,25,50); ? )uploaded it and there is... nothing. In the "view-source I see the :<pclass="weightedwordlist"> code, so by reading this topic I must asume I did everything right, yet I might have done something wrong or overlooked a little thing. Can anybody help me out?
    My site can be found at http://www.seacloudies.com

    p.s. Might it be that I donot have enough words in my blog (although I set the $mincount to 5 and it appears to work for chinaman)

    TIA CaramellaMorbide

  21. to_ul
    Member
    Posted 8 years ago #

    i have no glue why i get this error on my page:
    Warning: max(): Array must contain atleast one element in /Library/WebServer/Documents/php/wordpress15/wp-content/plugins/weighted_words.php on line 54

    i use wordpress 1.5.2 und i have activated the weighted plug-in...copy some code at my sidebar...
    can someone help me! please!

  22. Chachee
    Member
    Posted 8 years ago #

    More of a general CSS/PHP refresher lesson (new to WordPress/PHP):

    Currently I use 2 separate hover styles on my site. 1 is green, 1 is orange. Currently the WW words are using the orange color, but I want them with the green.

    Generally I would do this by adding a simple "class="GREEN"" tag, but I'm not sure the best way to do that in this setup. Additionally, I wouldn't mind being able to have a different font setup.

    Any tips would be greatly appreciated, and I love the plug-in.

  23. jwurster
    Member
    Posted 8 years ago #

    Has anyone had any problems with the count that appears when you hover over a word and the actual number of posts being wrong? Myabe I'm not understanding what the count number is. Is it the number of occurrences of the word or the number of posts in which it is found?

  24. yami
    Member
    Posted 8 years ago #

    Chachee: You can add entries in your stylesheet for

    p.weightedwordlist { }
    p.weightedwordlist a { }

    ... to change the whole paragraph, or just the links, respectively.

    Jwurster: The count is the number of actual occurrences of the word, not the number of posts.

  25. jwurster
    Member
    Posted 8 years ago #

    Have you ever found any scenarios when the count was wrong?

  26. yami
    Member
    Posted 8 years ago #

    No, but I haven't looked very hard, either. Have you?

  27. Dgold
    Member
    Posted 8 years ago #

    for some reason i never figured out this plugin broke on 2 of my sites, and still works on 1. It was as-if I suddenly got too many posts for WeightedWords to handle, or else I posted an unallowed character, or something? Had to disable WW, cuz it was crashing my sidebar from that point on down. :(

    Still like the plugin tho

  28. jwurster
    Member
    Posted 8 years ago #

    One thing I did notice is that the word in the ww list can be a part of a word in your post. For example, I have "table" displayed. When I click on it and go to the posts, I see "unpredictable" in one post. Is it supposed to work this way, treating the weighted-word as a text string? If it is, that's fine. Just need to know.

    Also, would it be possible to hi-lite the weighted-word in the post so you can easily recognize where it is referenced?

  29. yami
    Member
    Posted 8 years ago #

    WW uses the WordPress search engine to show where the word is used; if you want hilighting, I think Search Highlight will do it for you. That's also why you're getting "unpredictable" for "table" - WW doesn't count it, but WP search does. I don't know if Search reloaded would change that or not.

  30. jwurster
    Member
    Posted 8 years ago #

    yami, thank you for that information. The main reason I am asking is because I have ported your plugin to work with the Vanilla opensource forum software (others talked about on this support forum). I should have asked you first if you wanted to do this, but I didn't. It seemed like a good opportunity to learn how to work with Vanilla. If you want to take a further discussion offline, email me at jwurster at comcast dot net.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.