How to create a rotating header image in wordpress

by webgarden ~ April 1st, 2008. Filed under: Techy Stuff, php.

There is tons of information about how to make a random image header in wordpress, and just as many plugins -  however, I wanted to make my own rotating header image. If you are like me, and you want “complete control” over your site – here is the easy way to make a rotating / random header image:

  1. Create a folder called “header-images” & put your header images inside this folder
  2. Upload header-images to your wp-content folder
  3. Create a file called “rotate.php”
  4. Add the following code to your “rotate.php” page (you can copy and paste from here: http://ma.tt/scripts/randomimage/ )
  5. Upload rotate.php into the header-images folder (so that rotate.php is with all your images)
  6. In your theme’s “style.css” file find “#header”
  7. add the following code:
    “background: url (…/header-images/rotate.php);” (this is telling your header to add the rotate.php as the background image)
  8. Upload  your css file 
  9. Test  your site and your finished!

Questions? Send me a message or a comment and I will do my best to help  you out.

Leave a Reply