A great way to make the front page of your Web site more dynamic is to use random header images. Instead of seeing the same image on every visit, users will see random images, thus making each experience on your site a little less predictable (and a little more fun!).
Get the Goods!
Basically, the theory (and thus the code) behind this is quite simple, and I’ve prepared a random header image tutorial that you can peruse at your leisure if you’re into that sort of thing.
But, because I’m all about hooking you guys up with things that are simple, easy, and good, I’ve taken the liberty of preparing a brand new header.php file that you can download and install in order to get cracking with random header images.
Installation Notes: If you’ve made changes to your original header.php file, you may want to compare these two files first to ensure a smooth transition. Other than that, just overwrite the existing header.php file with this new one, and your headers will all be “randomized!”
Update: These files are now only provided for legacy support on versions 1.03 of the theme or older. If you’re running WordPress 2.1 and Cutline 1.1, then you’ll want this file for random header generation.
Some Web hosts do not support WordPress 2.1 on certain plans (MediaTemple’s old shared server plan, for instance), and because of this, I’ve chosen to keep these files around for folks who don’t have any other options. Of course, I suppose you could always switch to MidPhase, the hostess with the most-ess, but then you’d have too much of a good thing, right?
Assumptions:
This special header.php file assumes that your images are named according to the following default convention:
header_1.jpgheader_2.jpgheader_3.jpgheader_4.jpgheader_5.jpg
Special Case Solution
The default code in this new header file should work for most people, but what if you want to use the random effect and you want special images to appear on certain pages?
I’ve got you covered.
For you special cases out there, I’ve prepared yet another header.php file that contains the necessary PHP and XHTML to accommodate your needs.
So, instead of using the file referenced above, use this one instead!
Update: Once again, I’m leaving this file here for legacy support only. If you’re running WordPress 2.1 and Cutline 1.1, then you’ll want this file for special random header generation.
It should be pretty straightforward, but if you have any questions at all, you know where to find me!





Hi Chris,
Thanks so much for this nice post. I was wondering, after I uploaded the random header file, my blog description is gone?
I noticed that its missing the “bloginfo(’description’);” on the random page, is this why?
How to change the header code so that you can specify a differend image for each category.
Tom, please check out this thread in the forums.
http://cutline.tubetorial.com/forums/showthread.php?p=3034
We invite everyone to use the Support Forums to ask and answer questions about the Cutline Theme.
Your instructions were really appreciated.
I’m not sure, but I think that I’ve got it. I’ve converted the header into different banners, and it’s working.
http://www.homesweetdollars.com/wordpress
I’m using this blog for my home business. Now only, IF I’d dare to update. Still running on 2.5.
Thank you very much.
Thanks a million for the random image generator it works wonderfully and I am like a cat with 2 tails.
No make that 5 tails!!