Stan’s Obligatory Blog

12/28/2004

More WordPress geek stuff

Filed under: — stan @ 1:49 pm

A long time ago, I wrote a little PHP routine for our main home page to automatically add holiday decoration at the top of the page. I adapted it for WordPress today. I made a file ‘wp-holidaydecor.php’ which queries the database to get the next holiday and its lead time. If there is a holiday coming up, it calls a function to insert an appropriate image from the ‘holidayimages’ directory. I had to hack the main WordPress ‘index.php’ file and add one line:

< ?php include (ABSPATH . 'wp-holidaydecor.php'); ?>

I added this right after the ‘<div id=”content”>’ line.

The other part of this is the ‘holidays’ table I added to the database. I wrote a little Perl script that calculates the dates of the holidays and populates this table a year at a time. Right now, it’s filled through 2005.

Comments are closed.

Powered by WordPress