On: 2005/04/29 Viewed: 68077 times
Shorter URL for this page: http://ozh.in/l4

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 :

  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 :

  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)

  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 :

  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 !

Shorter URL

Want to share or tweet this page? Please use this short URL: http://ozh.in/l4

Metastuff

This page "WordPress Plugin : Random Words" was posted on 29/04/2005 at 9:45 pm
Watch this discussion : Comments RSS 2.0.

87 Blablas

    Pages: [1] 2 » Show All

  1. 1
    RaynerTheApe Bulgaria »
    replied, 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 »
    commented, 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 »
    wrote, 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 »
    replied, 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 »
    replied, 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 »
    replied, 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 »
    wrote, 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 »
    wrote, 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 »
    wrote, 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 »
    commented, 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 »
    said, 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 »
    wrote, 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 »
    thought, on 13/Sep/05 at 1:42 pm # :

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

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

    Solution is here.

  16. 16
    johngb Australia »
    wrote, 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之外,順便在這裡也作個備份吧! 有緣看到的人也算是結個緣囉~~ [...]

  21. 21
    maximum Russia »
    replied, on 15/Apr/06 at 2:18 am # :

    Thanks!

  22. 22
    SecurityWonk United States »
    said, on 21/Apr/06 at 9:42 pm # :

    Can't get this to work on my wp 2.02 install. When I click on Options > Random Words it tries to go to ../wp-admin/wp_ozh_randomwords.php. This file doesn't exist. What am I doing wrong?

  23. 23
    yoli United States »
    commented, on 09/May/06 at 1:30 am # :

    When I try to create a list in WP 2.0.2 I get this error message:

    Warning: array_push(): First argument should be an array in /home/dragoonn/public_html/yellow7/wp-content/plugins/wp_ozh_randomwords.php on line 235

    Have I downloaded/uploaded the file incorrectly or is it just not WP 2+ compliant (yet?)? I really love this script so if it's the latter, do you have plans to make it so soon? It is hands down the best randomization plug-in I've found for my quote hoarding tendencies.

  24. 24
    Rex Strother United States »
    commented, on 26/Jun/06 at 7:28 pm # :

    Love it. Couldn't find a random image + caption generator for my news satire "blog" (without building a gallery somewhere) – but your plugin does the trick neatly, since it allows for the line to include HTML.

    Random "Words" is generating the "Breaking News" image and caption in my Column B.

    http://www.lowlights-now.com

    Thanks so much! And I'll be using it elsewhere on the site with other lists. Thanks so much.

    Question: I notice that hyphenated words (like "drug-induced" will not break at the hyphen and are forced to the next line; could that be changed?)

  25. 25
    review Russia »
    commented, on 29/Sep/06 at 9:48 pm # :

    random text+

  26. 26
    Marci United States »
    commented, on 03/Oct/06 at 9:38 pm # :

    I have been enjoying this plugin for some time without issue, but today I tried to make a new list, and change an old one, and I keep getting "Something went wrong: unable to save lists in the datadase." Is this using the MySQL database? And if so, what is the table name? I can tell that the admin function is pulling data from somewhere, and it's all showing up on the site just fine, but I need to locate the database (or find how/where it's being called by the script) so I can figure out what's up. Thanks!

  27. 27
    Ozh France »
    wrote, on 04/Oct/06 at 8:16 am # :

    Marci » everything is stored along with WP options, i.e. in a line inside table 'wp_options'

  28. 28
    Sindhu India »
    commented, on 12/Nov/06 at 10:15 pm # :

    nice plugin, havent tried it as yet, will in a while. and i must tell u ohz, i cant live without that drop down menu plugin life saver! :D its gotta be there in all wp installations, feels like shit without it. thankx a lot :D

  29. 29
    Dmitri Finland »
    wrote, on 15/Nov/06 at 10:39 am # :

    A small tip for everybody, who wants a random -tag text. Edit your html like this:


    < ?php the_content(wp_ozh_randomwords('more',0))?>

    Didn't find info about this second parameter "0″, so had to search thru php code :)

  30. 30
    Ozh France »
    replied, on 16/Nov/06 at 10:24 pm # :

    Wow, THAT's a smart use, thanks for the idea I like it :)

  31. 31
    Marci United States »
    wrote, on 28/Nov/06 at 8:01 am # :

    I posted back in October that I could not get the plugin to write to the database (“Something went wrong: unable to save lists in the datadase.”) and I am still having the problem. I can now find the data in MySQL, but I can't figure out how to get the plugin to save/edit. This was all working fine at one time. Any hints on what to check to resolve this? It's a really important part of my site, and I love this plugin!! Thanks :)

  32. 32
    Marci United States »
    said, on 05/Dec/06 at 10:21 am # :

    Just checking to see if there is any hope for my problem. Has anyone else experienced this? What would cause the DB to not accept input from this plugin? Any ideas would be appreciated. Thanks!

  33. 33
    Marci United States »
    wrote, on 13/Dec/06 at 8:53 am # :

    This is wierd…in spite of an error message which says it cannot write to the database, in actuality it IS writing to the DB, but it just generates the error message anyhow. Any idea why that would happen?

  34. 34
    Steve United Kingdom »
    wrote, on 03/Jan/07 at 3:32 am # :

    Nice plugin Oz – thanks a lot. I'm using it to pick out random sponsors who have donated to my daughter's fundraising – you can see it at http://www.emilydunnett.com on the sidebar and thank you page.

    Any chance you could tell me a function to just return all the words in a list so I could format up a sponsor cloud. You wrote the code in a compact and excellent manner and while I will be able to get it in the end it might be a feature other people could use also.

    Thanks again!!

  35. 35
    Quick Plugins Link 1 | Wordpress Tutoria... United States »
    pingback on 13/Jan/07 at 9:37 pm # :

    [...] Random Words - from within a neat admin interface, manage lists of "items" (words, quotes, images…) and display random items in your pages or posts. [...]

  36. 36
    新装了Ozhçš„Random Wo... United States »
    pingback on 15/May/07 at 8:40 am # :

    [...] 就是显示留言者来源国家的东东. 今天再次去PlanetOzh寻宝, 把Random Words和Click Counter两个东东装上了, 其中的Random [...]

  37. 37
    gina Canada »
    replied, on 08/Jun/07 at 9:57 pm # :

    I need some words for a title for my song. It's about a guy I dated and what not, well I always give gifts to him and he never give a gift to me. So I'm writing a song about him but can't find a title for it.

  38. 38
    Ozh France »
    said, on 08/Jun/07 at 11:37 pm # :

    Name it: "the girl who had no clue about the sites she was reading". Duh.

  39. 39
    Pixelation United States »
    replied, on 25/Jun/07 at 2:26 am # :

    Insane! This is the greatest plug-in I have ever used! And I mean that so seriously: I have rotating blog descriptions on my header that I'd been using bulky javascript to produce.

    I think you just shortened my load time by half and made my list so much easier to access. Kudos

  40. 40
    1881: Secret treaty between Austria and ... United States »
    pingback on 28/Jun/07 at 9:52 am # :

    [...] Although my articles page calls attention to what I feel are my best posts. Last and greatest is Ozh's random words. Now, whenever you comment, it's just as likely to say "You bitched" as [...]

  41. 41
    WP Plugins DB » Plugin Details &ra... United States »
    pingback on 30/Jun/07 at 12:12 pm # :

    [...] Visit [...]

  42. 42
    Huug & Druug » Random Words pl... France »
    pingback on 12/Jul/07 at 3:53 pm # :

    [...] onledig gehouden met het verzinnen van "random words" voor hier op mijn blog. Je kan het dink overal voor gebruiken tot in de reacties toe. Meer verklap ik niet. Zo geestig. F5-en rulez! En zie [...]

  43. 43
    ritalink.org_________if life were only l... United States »
    pingback on 23/Jul/07 at 7:37 am # :

    [...] Random Words es un plugin para WordPress que permite manejar listas con cierto número de elementos, y mostrar elementos aleatorios de cualquiera de ellas. Se maneja desde la interfaz del admin y se puede citar cuantas veces y en cualquier parte que se desee, hasta lograr cuanto entropismo de contenido pueda parecer necesario. Random Words es también nuestro about que es una lista de citas aleatorias distribuidas en la página. estas han sido seleccionadas por su elocuencia y valor descontextual. es un sampler. y un looper, para verlo, F5. Algunas de las frases pueden ser fácilmente reconocidas, otras menos. La lista esta abierta a sugerencias. Pueden comentarlas o enviarlas a about|en|ritalink|punto|org tags// [...]

  44. 44
    navayo Germany »
    replied, on 03/Aug/07 at 3:31 pm # :

    Hi i just installed the plugin and activatet it, but when i go to options -> random words i just get an empty 404-page. what can i do?

  45. 45
    Ozh France »
    wrote, on 03/Aug/07 at 7:23 pm # :

    navayo » don't know… Install properly, perhaps ?

  46. 46
    VintFalken.com Housekeeping | VintFalken... Netherlands »
    pingback on 20/Aug/07 at 7:05 pm # :

    [...] Random Words : adds the ability to play with 'random' lists without to much hassle. I'm sure I shall think of some neat ways to use it. Either that or it stays 'disabled' until eternity. ;) [...]

  47. 47
    FD United States »
    replied, on 26/Sep/07 at 1:02 am # :

    I was wondering if this works with WordPress 2.3? I've been trying to add it to my comments but so far I haven't been able to get random words to show up.

  48. 48
    Ozh France »
    thought, on 26/Sep/07 at 8:41 pm # :

    FD » works fine on my 2.3 installs (should work on 1.5 up to 2.5)

  49. 49
    FD United States »
    commented, on 26/Sep/07 at 9:05 pm # :

    Thanks for the response. It's entirely possible and probable that I'm doing something wrong. Basically, I'm just trying to place it in my comments and have it replace the typically "said" with something I choose. Is there any chance you can tell me where exactly I need to put this to make it happen? I'm using the Vistered Little 1.7.6 theme and WordPress 2.3.

    Thanks.

  50. 50
    torquemada Spain »
    thought, on 27/Dec/07 at 6:29 am # :

    hi OZH,

    i tried it but in posts apears always the complete list, not only one random word of the list. What could be wrong ?

    Is it always necessary to integrate the "" part or the "[random:name_of_list]" paart works alone also ?

Pages: [1] 2 » 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.