PHP Countdown Script for wordpress

Tian, a fellow blogger, suggested I add a new item to my countdown list (right side of page). The new item would countdown the days until we get to correct the mistakes of November 2nd. I though it was a great idea, so I added the new countdown.

I’m posting the scripts I use to generate those countdowns here for anyone else who wants to add this functionality to their blog. These scripts are specific to wordpress, but perhaps you can adapt them if you are using a different publishing system.

To make these work in worpress, put the Simple Day Counter script in your my-hacks.php file. You then call the script from your index page with “day_counter(day,month,year)”. For example, My countdown for George W looks like this… “< ?php day_counter(5,11,2008) ?> boot George W”. The “days to” or “days since” is filled in by the script you placed in your my-hacks.php file.

tip: The countdown considers a day, a 24 hour period, not a calendar day. For instance, if today is 11/08/04 and you have an event on 11/09/04, the countdown will show this as “0 days to (your event)”, because tomorrow is less than 24 hours away. I didn’t like this. I wanted it to say “1 day to (your event)”. I don’t know enough about php to change the script, so I just add a day to the date I enter for the event to compensate.

Feel free to contact me if you have any questions about configuring this. I may be able to help.

You can download my copy of the “my-hacks.php” file here.

1 thought on “PHP Countdown Script for wordpress”

Leave a Comment