Spin ye’ head

I wrote a simple header image rotator today to be able to substitute the boring blue “thing” with a 4th of July photo. The script is a variation on the header-img.php script included with the Kubrick 1.5 shipped with WordPress as default theme.

Download

Get the zip-file: header-rotate-1.0.zip

Installation

Unpack the zip-file you downloaded. You will now have a directory called header-rotate-1.0, enter into it.

Copy the functions.php file into the default theme folder. This will replace the old one in the theme folder, make a backup or rename it if you like.

Copy the content of the images folder into the default theme folder with the same name.

Officer, you’re now all set for rotation!

Usage

The rotator is easy to use and follow a simple convention without the need of any configuration.

When you installed the rotator you added two new directories to the images folder called events and random. Those are your two new image directories where you put the images you want as background in the header.

The script will first check the events folder for any images that match the current date. To match a specific date (year, month and day) for example this 4th of July you name the image file 20060704.jpg. However, to match the 4th of July every year you simply omit the year like this 0704.jpg. The same goes for matching a particular day every month, 04.jpg, will match the 4th of January to December.

If there isn’t a matching event image the script will then pick a random image from the random folder. Random images do not follow any particular naming convention.

If you don’t want a randomly choosen header image, but a “static” header image of your choice, just put a single file in the random directory that will be loaded every time.

This entry was posted in General and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.