Easy Random Posts Plugin for WordPress
While I was working on my new theme for thisismyurl.com I came across the need to publish a series of random posts in the side bar and so I put together a simple post randomizer for WordPress. The tool works like most WordPress theme calls and features:
- Customizable number of links returned
- Customizable before and after to ensure you can display the results
- The ability to echo or return results
To use the plugin, install it to your WordPress website and edit your theme files by placing the following code:
General results
Without passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.
[source lang="php"]<?php randomPosts();?>[/source]
Specific number of results
If you would like to return a specific number of results as your maximum:
[source lang="php"]<?php randomPosts(‘count=10′);?>[/source]
Echo vs. Return
Finally, if you’d like to copy the results into a variable you can return the results as follows:
[source lang="php"]<?php randomPosts(‘echo=false’);?> [/source]
Download
Support forums are now online! If you have any questions, please visit http://forums.thisismyurl.com.






thx christ, for the posting pulgin i am find it…
thanks for such a nice plugin.
factshelf.com’s last blog post..Want to earn extra income?
[...] verwende dazu das Plugin Easy Random Posts, welches wie folgt in den Zufallsgenerator mit eingebaut ist: <div [...]
Thanks for the plugin. I was looking for something like this for a while…
Webkinz’s last blog post..May 30th Surprise Saturday at the Ganz eStore
Thanks for this plugin which is useful, put some not so popular articles
Hi Christopher. I had your plugin on my blog, but, when the people writed a comment, the commet was published in a random post, maybe because the function random was before of the comments template. Thank you for the plugin and I hope that you fix it. Can you send me an e-mail if the mistake is mine?
.-= ZoiX´s last blog ..iQ Font, cuando conducir se convierte en escribir =-.
@ZoiX – hm … I’ve not seen that before, but I’ll take a look and see if there’s something funny happening in the code. Chris
Hi Chris,
When you say as the command *<* to your theme files, which ones are you referring to?
Do you mean that the command needs to be added through theme editor in WP? If so, which file? To index.php, home.php? ( I tried those, and nothing happens! :(
Sorry, I’m a newbie and have VERY little understanding of PHP, so it would help if I knew where to place it.
Thanks,
Erik