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
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 :
-
a nice person
-
a <em>porn star</em>
-
so <em>cute</em> !
-
<span style="color:purple">teh master of teh intarweb</span>
-
reloading the page
-
pretty. Well, sort of.
In this page I wrote :
-
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)
-
trackback: trackback, pingback, chmlmlback, stuffback, sumthinback, trackpingback
-
comment: wrote, said, replied, thought, commented
-
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 :
-
<em>640K ought to be enough for anybody.</em><br />»<strong>Bill Gates</strong>, 1981
-
<em>A fast word about oral contraception. I asked a girl to go to bed with me, she said 'no'.<br />»<strong>Woody Allen</strong>, yesterday
-
...
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 !
Pages: [1] 2 3 4 » Show All
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.
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)
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...?
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:
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.
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 :)
said, on 14/May/05 at 3:30 pm # :
Thanks for the suggestion, I've changed it
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...
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?
said, on 18/May/05 at 7:12 am # :
Sure. The file must sit in /wp-content/plugins, where every plugin file must be.
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.
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:
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:
Any help would be great!
John
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.
wrote, on 13/Sep/05 at 1:42 pm # :
Okay good idea - the paste is here.
Thanks again!
replied, on 13/Sep/05 at 3:13 pm # :
Solution is here.
thought, on 13/Sep/05 at 3:32 pm # :
Thanks heaps mate - Australia loves you.
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). [...]
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 =]
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.
pingback on 27/Jan/06 at 6:27 am # :
[...] 後來想到我有訂閱慈濟的電åå ±ï¼Œè€Œæˆ‘åŽŸæœ¬å°±æœ‰ç”¨Random Words來當隨機出ç¾çš„ æ¯æ—¥éœæ€èªžï¼Œæ„Ÿè¦ºé‚„ä¸éŒ¯å•¦ï½žï½žæ…ˆæ¿Ÿé›»åå ±é™¤äº†æœƒæœ‰æ¯æ—¥éœæ€èªžä¹‹å¤–,å¶çˆ¾é‚„會有è‰åš´èªªæ•…事~è‰åš´ä¸Šäººé–‹ç¤ºï¼Œå°±æ˜¯ç”¨ä¸€ç¯‡çŸçŸçš„æ•…事來說明一些é“ç†ï¼Œæˆ‘感覺還ä¸éŒ¯ï¼Œå¾Œä¾†å°±æƒ³èªªï¼Œä¹¾è„†æŠŠé€™å€‹æ”¾åœ¨aside好了,除了我自己的gmail都有留下æ¯å°mailä¹‹å¤–ï¼Œé †ä¾¿åœ¨é€™è£¡ä¹Ÿä½œå€‹å‚™ä»½å§ï¼ 有緣看到的人也算是çµå€‹ç·£å›‰ï½žï½ž [...]