Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:RobMientjes/Zooiblog

Here are listed some things I use. They're not all WordPress related, but at least they could improve your experience :op

Randomizer

In the sidebar of my blog I use a PHP script that randomizes a dozen quotes. After some logical thinking, I figured out how to make it pop stuff out of the box, and I use it for quotes. Please, have fun with it, but attribute - it took some time (and you'd get my code puppet pretty angry too).


<?php function qq() { $q = array( "Quote 1", "Quote 2", "Quote 3", "Quote 4", "Quote 5"); srand((double) microtime() * 1000000); return $q[rand(1, 5)]; } echo qq('[]'); ?>

(Please note that you must edit the return function: '1, 5' should be '1, [the number of quotes you have]'.)

Have fun.

Comments on the randomizer?

--NuclearMoose 17:15, 30 Aug 2004 (UTC) Love the randomizer. Thanks for sharing this, Rob!

--MathiasBynens 17:08, 5 Feb 2005 (UTC) Cool script. I was using something similar for my taglines, before I redesigned to v4. Anyway, if you're too lazy to change the '1, 5' thing every time you add a quote, you could use something like this:


<?php function qq() { $q = array( 'Quote 1', 'Quote 2', 'Quote 3', 'Quote 4', 'Quote 5'); return $q[array_rand($q)]; } ?>