WordPress.org

Ready to get started?Download WordPress

Forums

new plugin - weighted words (32 posts)

  1. yami
    Member
    Posted 8 years ago #

    So hey, it's My First Plugin!

    http://greengabbro.net/plugins/weighted-words/

    It provides a template tag that lists commonly-used words from your blog posts, and displays them in a trendy heat map. Answers burning questions like "gee, do I overuse the word 'antidisestablishmentarianism'?"

    It's fairly straightforward, but please let me know if you have any problems with it.

  2. Lorelle
    Member
    Posted 8 years ago #

    Very cool! Great work. Are you going to enter it in the contest?

  3. cron
    Member
    Posted 8 years ago #

    Looks cool. Just a sugestion, can you make it work with nice URLs for the search string? using mod_rewrite? That would be awsome

  4. 3stripe
    Member
    Posted 8 years ago #

    Nice! One of those things I keep seeing and wondering how it's done... http://www.43things.com in particular....

    (Out of interest, how the hell do you go about programming something like this?)

  5. DanM
    Member
    Posted 8 years ago #

    Heh, thanks for this. I was actually googling on how to create something like this, but to no avail.
    Good work :)

  6. userx
    Member
    Posted 8 years ago #

    How exactly is this called?

  7. Lorelle
    Member
    Posted 8 years ago #

    The technique or the name of the plugin? The plugin is "weighted words" and the technique is called a "Heat Map".

    It is similar to what is now on the front page of this forum - all those words at the top. Some think it is totally cool and others think clutter, but it is certainly a hot new way of providing another way of finding the information you want on a site.

  8. shadow
    Member
    Posted 8 years ago #

    I may be wrong Lorelle, but I think userx is asking how to actually call the plugin into action [as in, how to use it] :)

  9. Jinsan
    Member
    Posted 8 years ago #

    by my understanding when someone says "how is this called" it usually means how to call it in the page, not the explanation of what it is. The OP already explains it.

    I believe it's something like:

    <php? weighted_words($mincount, $minlength, $minfont, $maxfont); ?>

    Placing the above where you want to display it, such as your archives template.

    The instructions aren't very clear for someone who hasn't used this before, and so the instructions need a rewrite. Specific code, how it can be used and examples would be very beneficial.

  10. robot
    Member
    Posted 8 years ago #

    Yes, I need some examples. Is it possible to put it on a page written with the Write Page thingy?

  11. shadow
    Member
    Posted 8 years ago #

    @ yami

    Thanks for sharing your plugin :)

    I have it running here but it seems to picking up parts of words as well as whole words. For example:
    It lists wind which, when you check the post it retrieves, is also part of Windows etc...

    Is this how it should work?

  12. yami
    Member
    Posted 8 years ago #

    Lorelle: I doubt I have much of a chance, but should probably put it in the repository anyway...

    Cron: Good thought, but I'm not sure how to retrieve a person's permalink structure - anyone know? This way will work for everyone. If you know how to work with php echo statements you can edit it yourself, I'll upload a new version with a comment for that line.

    3stripe: I cribbed from a similar plugin for Moveable Type and the weighted categories plugin. Altering something similar is usually easier than working from scratch :)

    Shadow: Huh, that's odd! The plugin splits on spaces and a variety of punctuation marks, so it picks up so-called words like "wouldn" - but it shouldn't be thinking that "windows" is the same as "wind". However, Weighted Words only counts 27 uses of "wind" but the search returns over 40 results - so this seems to be an issue with WP's search function being a little overinclusive. I'll look into it... thanks for the report :)

  13. yami
    Member
    Posted 8 years ago #

    Also, I'll have a stab at rewriting the documentation. Jinsan's got it right, though - just call the template function wherever you want the list to be displayed.

    Robot, to put it in a page or post directly, you'd have to use a plugin such as RunPHP that allows you to run php code within posts.

  14. userx
    Member
    Posted 8 years ago #

    Yes ... by asking "how is this called" I was referring to how it is called in the page, as in:

    <?php weighted_words(30, 4, 75, 300) ?>

    I should have been more clear. Thanks all ...

  15. robot
    Member
    Posted 8 years ago #

    userx, you are right. I have it implemented on my blog.
    http://robot.f2o.org/weighted-words

  16. hisyam
    Member
    Posted 8 years ago #

    as soon as i put the plugin in my wordpress's plugin directory, i got this error
    Parse error: parse error, unexpected '}' in /home/hisyam2/public_html/wp-content/plugins/weighted_words.php on line 59

    and it's not even activated..what da?

  17. robot
    Member
    Posted 8 years ago #

    Are you running the latest version of WordPress?

  18. Jinsan
    Member
    Posted 8 years ago #

    make sure that the start and the end of the php file contain NO white spaces or extra spaces. That's the only thing I can think of. Then reupload it.

  19. hisyam
    Member
    Posted 8 years ago #

    cool, thanks, i got it to work, and my highest word count is
    "day!bad" ???

    http://www.hisyam.com/about/ on wp 1.5.1.1

  20. fluideye
    Member
    Posted 8 years ago #

    nice one yami, thanks :^)

  21. vkaryl
    Member
    Posted 8 years ago #

    yami, this line:

    echo '/index.php?s=' . $word . '&submit=ww';

    needs to be changed to this:

    echo '/index.php?s=' . $word . '&amp;submit=ww';

    in order to validate to XHTML 1.0 Strict. Otherwise except for not being able to tweak one theme to left justify the first line of the word-list, it's working great!

    Thanks for a nifty addition.

  22. DanM
    Member
    Posted 8 years ago #

    hisyam, can I ask how you got around the error you were suffering from?

  23. hisyam
    Member
    Posted 8 years ago #

    i got an error after i downloaded, unzip, upload the file. after that i open the plugin file. went to the first line, hit enter and backspace/delete to make no spaces/extra spaces and did the same for the last line. the weird thing is that there were no extra spaces to begin with =/
    but anyhow after doing that the plugin starts to work again :)

  24. seanshaghaghi
    Member
    Posted 8 years ago #

    Thanks for the plugin. I was thinking about doing something like this myself, now I don't have to.

  25. DanM
    Member
    Posted 8 years ago #

    Heh, cheers hisyam.

  26. hisyam
    Member
    Posted 8 years ago #

    but im still wondering why is the plugin detect "day!bad" as a single word

  27. yami
    Member
    Posted 8 years ago #

    I'm guessing it had something to do with this post... that, and I left the exclamation point off the list of punctuation to use when splitting words, d'oh!

    I'll put together Version 1.1 sometime this week, with the validation fix (thanks, vkaryl!), punctuation fixes, and more detailed documentation. Hopefully it'll be sooner rather than later, but we'll see...

  28. hooopla
    Member
    Posted 8 years ago #

    Very cool! I agree that having nice URLs would be a plus.

  29. hisyam
    Member
    Posted 8 years ago #

    sweet, thanks for having a look at that. Will look forward for your next update, ofcourse...

  30. matsb
    Member
    Posted 8 years ago #

    Nice plug in, but I have a problem, it will not work with swedish letters lika Ã¥ ä and ö (I spell it with html if there is a problem with this letter here): å ä ö
    Instead of this letters this plug in shows questionmark (?)
    Anyone who knows how to fix this? Thanks!

    /Mats, Sweden

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.