How to Display Random Header Images

If you got a huge header, you can try to show to different images each time a user loads your site. You can rotate as many images as you want. But here for example we are giving you a example of three images. Hope this helps some.

random header images

One Step Procedure:

Note: Do take backup of your theme before you try this.

01. First rename your images with a underscore like these:

- randomimage_1.gif
- randomimage_2.gif
- randomimage_3.gif


02. Add this below code in your header.php file or the file where the code for your header image is placed:

<img src="http://path_to_images/headerimage_<?php echo(rand(1,3)); ?>.gif"
width="image_width" height="image_height" alt="image_alt_text" />


03. If you want to do with more images, change the number 3. That’s it.

  • Pingback: designfloat.com

  • http://twitter.com/AlphonseFM Alphonse

    Thanks for the post. Great to find out tips and tricks especially with php. Keep up the quality stuff.

  • Pingback: wp-popular.com » Blog Archive » How to Display Random Header Images

  • http://www.directorysubmissionservices.net Nick

    thanks for sharing such nice informative tips. I will use them in mine new peoject .keep it up..

  • http://www.topmailers.com/ bubble mailers

    That’s a really simple snippet of php code! It will be fun to try out on my own side. Now I just have to create multiple header images that I like. Cool!

  • http://twitter.com/jstolarski Jon Stolarski

    wow, nice and simple. I like it!

  • http://twitter.com/jstolarski Jon Stolarski

    wow, nice and simple. I like it!