![]()
Firas is a staff writer on Mike’s Life, and you can find out more about him here.
Today I am going to share with you a very cool trick which I've done many times with different clients, those who would like to use multiple header images for their blogs.
This is not a difficult task to do nor does it need a guru to get it done, all you need is to get the images you want ready (with the same size as the header of course) and name the files as follows: anyname_1.jpg, anyname_2.jpg, anyname_3.jpg and so on! The first part of the file name is flexible, you can change it, but you have to make sure to separate the numbers of the images with an underscore and use sequenced numbers.
After creating the files, you need to upload them to a specific folder on your server and then open your header.php file and place the following code where ever you want the images to show:
<img src="http://folder-path/anyname_<?php echo(rand(1,3)); ?>.jpg"
width="image-width" height="image-height" alt="alt-text" />
Make sure to do the following after adding this code:
1- Replace the "folder-path" with the actual path to the folder which you have uploaded the images on.
2- Make sure you change "3" in "(rand(1,3))" to the number of files you are using.
3- If you have renamed the images from "anyname" into another file name, make sure that all the images have the same name and also you have to replace "anyname" in the code above to the new file name.
4- Make sure to replace "image-width", "image-height" and "alt-text" with suitable values.
One last note, this code is a PHP code and works on any platform that is built on PHP not only Wordpress!
As well as being a staff writer on Mike’s Life, you find Firas at his own blog Steitblog and on Twitter@steitiyeh
Also worth reading:
1/ Multiple accounts on Twitter? Not for me!
2/ Windows Livewriter – the ultimate blog tool
Visit my You Tube Channel for videos all around about business and blogging.
Here's my most recent video:
I'm Mike CJ - welcome to Mike's Life! If you'd like to know more about me then please click About Mike.
If you're new here, please join the ML community using the form above.
And come and say hello on Twitter @mikecj
"Mike's Life is where you can stay current with the life, thoughts, successes and failures of Mike Cliffe-Jones. Never knowingly ordinary, Mike shares as much as possible about his work as a marketer and in business, as well as his enviable lifestyle on and in the oceans around The Canary Islands."