Update:
At the bottom of this page you can find a simpler solution to this question.
Update2:
I have currently removed the random banner from my design. Not because it didn’t work well, but because I wanted a simpler design.
As you might have noticed, the banner at the top of this site changes as you navigate the site. To implement this in WordPress is quite simple.
You need this plugin:
Random Banner
Random banner how to install
And a couple of banners. I made mine with a template I made in Photoshop. You can download my template here:
Template to edit the default banner in WordPress
Or you can make a couple of banners using this tool:
flickr-to-WP-banner
When you have set up Random Banner and made some top banners, place them in the random banner folder as noted in the instructions for the plugin.
Activate the Random Banner plugin.
Now you need to edit line number 27 in “header.php” for your current theme. You should replace the existing line 27 with this one:
#header { background: url("") no-repeat bottom center; }
NOTE: I have not bothered to install a plugin that lets me print pure PHP-code on my page, so you can not copy line 27 directly from here. You need to delete the space between < and ? before "php random_banner…"
…and off you go!
You can read about my current banners here.
Do you know if Random banner works with WordPress ver. 2?
I don’t know. But, I would highly recommend a better solution. Place this little PHP script in a folder with pictures and call it where you want a random picture from that folder:
http://www.eirikso.com/misc/random-PHP.txt
Here is an example:
http://solstue.com/mat/images/MimosaCardabela/random.php
This pulls a random picture from the folder at:
http://solstue.com/mat/images/MimosaCardabela/
Thanks a lot. It works perfectly. The randombannerscan beseen at my girlfriends site .
And the site is here.
[…] After checking Eiriks post on Random Images, I know I also needed this. Copycat deLuxe, right? […]
thanks for the script, I have created a file called random.php amd when i run it, it loads a different image everytime, just wondering though, as I’m new to PHP, how do i add this to my header.php on my wordpress site ?
Currently my logo, is shown by in wordpress ! what is the best way to fix this !
Matt.
You just have to find the place where the link to the current header image is. It’s in your theme somewhere. Very often in the header.php-file.
Then you replace the reference to the jpg-file with a reference to the random.php-script.
[…] 打從轉用wordpress以來,Random banner一直是我很想加的function。1.5時代也曾經化了一些時間研究,可是沒結果。來到2.6時代,search到高手的文章,終於成功了。 […]
Thanks Eirik. I think this is exactly what I’ve been looking for so that I can create my own banners and place them on my WP site. Trying it out right now…