Top Ad unit 728 × 90

Display Random Header Images in WordPress


Most blog designs get boring if they have a huge header picture and it is static. This is when this tutorial comes in to make your header images dynamic because it rotates on each visit. You can select as many images as you want to rotate randomly. It brings life to a blog.
First you need to name your images in this format:
  • headerimage_1.gif
  • headerimage_2.gif
  • headerimage_3.gif
You must separate the name with an underscore. You can change the headerimage text to himage or anything you like.
Once you have done that paste the following code in your header.php where you would like the images to be displayed or in any other file.
1<img src="http://path_to_images/headerimage_<?php echo(rand(1,3)); ?>.gif"
2width="image_width" height="image_height" alt="image_alt_text"/>
Make sure that you change the number 3 if you decide to do more than 3 images. This code is not exclusive for WordPress, it will work with any php based platform.
Display Random Header Images in WordPress Reviewed by Unknown on 10:28 PM Rating: 5

No comments:

All Rights Reserved by Boca Raton Real Estate © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.