On: 2005/04/29 Viewed: 42289 times

Random Words is another completely futile plugin which aims to bring entropy and randomness into your pages and even posts.

Ever got bored by comment pages with the same "Joe said", "Jim said" all page long ? Wouldn't it be funnier and more attractive if it printed something randomly from "thought", "wrote", "said" and "commented" ? Here we are.

Random Words is a Wordpress Plugin allowing you to manage a number of lists with any items, and display random items from these lists. Everything is managed from within the Admin interface of your blog, in a very neat interface. It stores its data in two fields of Wordpress' built-in Options table, and displays random entries at no cost (no extra SQL query used to fetch items)

Get it

Download the plugin :
ozh-random-words.zip
Extract and upload to your blog, preserving directory structure if any.
Note: download counter here and stats on wordpress.org may differ and reflect the number of downloads before this plugin was hosted on the plugin directory

Activate it, go the options page and follow the instructions.

Use it

Use the following syntax :

  • In .php documents :
    <?php wp_ozh_randomwords('name_of_list') ?>
    If you want the result returned but not echoed, add a second parameter with value zero :
    <?php $test = wp_ozh_randomwords('name_of_list', 0) ?>

  • In Posts or Pages :
    [random:name_of_list]

I don't see any reasonable use for this in posts, but well, I had to do it :)

Watch it

For example, I created a list named "you_are" with the following entries :

HTML:
  1. a nice person
  2. a <em>porn star</em>
  3. so <em>cute</em> !
  4. <span style="color:purple">teh master of teh intarweb</span>
  5. reloading the page
  6. pretty. Well, sort of.

In this page I wrote :

HTML:
  1. I see, I see ... that you are [ random: you_are ]

The result is (reload to see it change) :
I see, I see ... that you are a porn star

Keep list names short and avoid funky characters, but use anything including HTML in the entries. It has to be one-liners, but you can insert a manual <br/>

Push it

A few suggestions, or examples of use (name of the list, followed by items of the list)

CODE:
  1. trackback: trackback, pingback, chmlmlback, stuffback, sumthinback, trackpingback
  2. comment: wrote, said, replied, thought, commented
  3. emphasis: extremely, wickedly, awesomely, completely

You could also use it as a Quote of the Second script : create a list named "quotes" and add entries like :

CODE:
  1. <em>640K ought to be enough for anybody.</em><br />&raquo;<strong>Bill Gates</strong>, 1981
  2. <em>A fast word about oral contraception. I asked a girl to go to bed with me, she said 'no'.<br />&raquo;<strong>Woody Allen</strong>, yesterday
  3. ...

Tell me

Got a suggestion, a bug report, something to tell, to thank or to complain about ? Using this plugin on your blog ? Made something fun with it ? Tell me !

Related posts

Metastuff

This page "Wordpress Plugin : Random Words" was posted on 29/04/2005 at 9:45 pm
Watch this discussion : Comments RSS 2.0. You can trackback this post from your own site

67 Blablas

    Pages: [1] 2 3 4 » Show All

  1. 1
    RaynerTheApe Bulgaria »
    wrote, on 30/Apr/05 at 10:17 am # :

    Excellent plugin! I have added random comment verbs already but also tried to combine your plugin with the plugin CA-Credits, which adds a "Thanks to {commentors} for commenting." Which uss the following PHP call:

    < ?php ca_credits('Thank you ',' for commenting.',', ',' and ',50); ?>

    I tried adding calls to your plugin as follows

    < ?php ca_credits(wp_ozh_randomwords('thankyou1'),wp_ozh_randomwords('thankyou2'),', ',wp_ozh_randomwords('thankyou3'),50); ?>

    When I execute this PHP call I get all the random words in the beginning and the database query result after the random words like:

    Thank youfor commentingand User 1, User 2, User 3....

    I don't understand this behavior, and it might be some PHP problem with calling one function from another... if you have any idea how to fix this, I'd be really greateful. I want to make the "Thank you" plugin a bit more enthropic and as if I write it by hand.

  2. 2
    Ozh France »
    wrote, on 30/Apr/05 at 1:50 pm # :

    I think you didn't understand how my plugin works. There's no need to create thankyou1, thankyou2 and stuff. Create just *one* list, named 'thankyou', and populate it with "Thanks", "Thank you", "I kiss", "Thx 2" or whatever.

    Then, I'm not using ca-credit but from what I understand of how it works, combine function calls like this : replace its first argument, "Thank you", by a call to my plugin which will return, not print, a random entry.
    So the original code :
    < ?php ca_credits('Thank you ',' for commenting.',', ',' and ',50); ?>
    Becomes with my plugin embedded :
    < ?php ca_credits( wp_ozh_randomwords('thankyou',0) ,' for commenting.', ', ' ,' and ', 50); ?>

    Should work fine (and by the way this is a nice idea of fun plugins combo)

  3. 3
    RaynerTheApe Bulgaria »
    commented, on 30/Apr/05 at 5:18 pm # :

    Thanks for the help. I might use this, but I was hoping I could have three random lists that change all the strings. For example I wanted to have "for commenting" changed sometimes with "for daring to comment", etc. Basically every scripted message I want to have it randomized. So then it sould be like...?

  4. 4
    RaynerTheApe Bulgaria »
    said, on 30/Apr/05 at 5:23 pm # :

    Okay, solved it myself. It was the 0 parameter in your plugin's PHP call. The proper code should be:

  5. 5
    RaynerTheApe Bulgaria »
    wrote, on 30/Apr/05 at 5:29 pm # :

    One last thing. I've noticed that the random generation is not really that random - one of the choices usually seems to be appearing in 2/3 of 8-9 cases. I don't know if you've noticed something like that, or it is that I have very few (5-6) random words in a list.

  6. 6
    cosa Indonesia »
    said, on 14/May/05 at 12:19 pm # :

    to make it more random, i think you should change rand() to mt_rand(). According to PHP documentation, mt_rand() function will return a better random value.

    btw, nice plugin Ozh :)

  7. 7
    Ozh France »
    said, on 14/May/05 at 3:30 pm # :

    Thanks for the suggestion, I've changed it

  8. 8
    My Other Side of the Stories United States »
    trackback on 15/May/05 at 4:24 am # :

    How to Combine CA-Credits with Random Words Plugin

    Couple days ago, Ozh released a nice plugin called Random Words. This useful multi-purpose plugin is used to display random text (not words actually ) from a specified list. You can use it to display random quotes, random verse, random image, etc.
    O...

  9. 9
    Charles United States »
    commented, on 18/May/05 at 4:16 am # :

    Hey, just started experimenting with Wordpress and ran across your plugin, I'm using the latest Wordpress install, but get an error when trying to access the "Options" tab "Random Words" Fatal error: Call to undefined function: add_action() in /wp-admin/wp_ozh_randomwords.php on line 327. Any ideas what i'm doing wrong on the install?

  10. 10
    Ozh France »
    said, on 18/May/05 at 7:12 am # :

    Sure. The file must sit in /wp-content/plugins, where every plugin file must be.

  11. 11
    cj United States »
    wrote, on 20/Jul/05 at 12:13 am # :

    im new to all this stuff...but i put in your plugin. it comes up in the plugin field, i activate it and create a list. however, when i put in the little php line in my sidebar it does not show up? what am i doing wrong? probably a lot of things...but any help would be appreciated.

  12. 12
    johngb Australia »
    thought, on 13/Sep/05 at 6:14 am # :

    Hi Ozh - I've just installed both this random word plugin and the click counter - both great ideas!

    I'm having a little trouble with this plugin, though - I thought that it would be great for using as a description of comments: e.g. '1 snappy retort' or '5 snide remarks' etc., instead of the boring '2 comments' type of thing.

    I made a list in the options tab of Wordpress called "comment" but when I went to embed the code

    into the index.php
    file (I was editing in the admin pages) I would always get the error message:

    Parse error: parse error, unexpected T_STRING in /.../blog/wp-content/themes/GeminiBlue/index.php on line 22

    I tried embedding the same string as above in another part of the page and it worked just fine. I think that the problem was to do with the fact that there were round brackets and apostrophes around the code. Here's exactly what it looked like in context:

    '), __('% s')); ?>

    Any help would be great!

    John

  13. 13
    Ozh France »
    replied, on 13/Sep/05 at 9:56 am # :

    John, send me an email or paste the code you are trying to use.
    I'll have a look.

  14. 14
    johngb Australia »
    wrote, on 13/Sep/05 at 1:42 pm # :

    Okay good idea - the paste is here.
    Thanks again!

  15. 15
    Ozh France »
    replied, on 13/Sep/05 at 3:13 pm # :

    Solution is here.

  16. 16
    johngb Australia »
    thought, on 13/Sep/05 at 3:32 pm # :

    Thanks heaps mate - Australia loves you.

  17. 17
    Stop Being Carbon » SBC Redesign Germany »
    pingback on 20/Sep/05 at 4:11 pm # :

    [...] Die installierten Plugins (darunter Gravatars, Wordpress HashCash und Random Words) werde ich beibehalten, wenn auch manche leicht abgeändert (Technorati Tagging). [...]

  18. 18
    4ndr3w United States »
    wrote, on 18/Dec/05 at 12:22 pm # :

    Hi:
    Great plugin, I use it to display random FireFox banners. One major problem though, after I installed it, I noticed that instead of showing my posts, it says:
    Warning: call_user_func_array(): First argumented is expected to be a valid callback, 'wp_ozh_randomwords_spostcontent' was given in /home/bobturbo/public_html/andrew/wp-includes/functions.php on line 927

    I have no idea what to do.. please help =]

  19. 19
    Ozh France »
    wrote, on 20/Dec/05 at 1:57 am # :

    Andrew » I have no idea of what you're trying to do. 'wp_ozh_randomwords_spostcontent' is obviously not a function of my plugin.

  20. 20
    maTT cHEn {dot} info » é—œæ... United States »
    pingback on 27/Jan/06 at 6:27 am # :

    [...] 後來想到我有訂閱慈濟的電子報,而我原本就有用Random Words來當隨機出現的 每日靜思語,感覺還不錯啦~~慈濟電子報除了會有每日靜思語之外,偶爾還會有證嚴說故事~證嚴上人開示,就是用一篇短短的故事來說明一些道理,我感覺還不錯,後來就想說,乾脆把這個放在aside好了,除了我自己的gmail都有留下每封mail之外,順便在這裡也作個備份吧! 有緣看到的人也算是結個緣囉~~ [...]

Pages: [1] 2 3 4 » Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Close
E-mail It