Display Random Header Images in WordPress

First you need to name your images in this format:

  • headerimage_1.gif
  • headerimage_2.gif
  • headerimage_3.gif

 

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.

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s