t a l l a p e

Decided to spend a bit of time playing with the theme this morning, seeing what I could mod about it.

I started by grabbing the default header image, and using Photoshop to make a couple of alternate versions. 4 alternate versions, to be exact.

I copied the default stylesheet file to a new one, called style.php (thereby allowing me to mod it all I want while having the original around).

Then I added this code to the new style.php file:

< ?php
$_masthead[] = "wp-content/themes/rin/images/masthead.jpg";
$_masthead[] = "wp-content/themes/rin/images/masthead-inverted-blue.jpg";
$_masthead[] = "wp-content/themes/rin/images/masthead-glowing-edges.jpg";
$_masthead[] = "wp-content/themes/rin/images/masthead_sunrise.jpg";
$_masthead[] = "wp-content/themes/rin/images/masthead_sunset.jpg";

srand ((double) microtime() *1234567);
$random_masthead = rand(0,count($_masthead)-1);

// echo "" . $_masthead[$random_masthead] . "";
$masthead_image="$_masthead[$random_masthead]";
?>

This gives a variable ($masthead_image) that’s always populated with the name of a header image, but which randomly rotates through them. (The code itself was slightly modified from the example at http://scripts-kbec.com/php_tutorial_random_css.php.)

Then I changed the #background section of the stylesheet, to read

background: url(< ?php echo "$masthead_image"; ?>);

Finally, in order for the php to be processed, it has to be included (rather than referenced). So I changed the <style> section of the header template to

<style type=”text/css” media=”screen”>
<?php
include “style.php”;
?>
</style>