I Squashed a Bug!


So, in the course of trying to get all the old functionality working on WordPress 1.5, I turned my attention to getting the “Today’s Photos” stuff working again. An awful lot of that code was in the hacks file, so I knew I had some potential for challenges. However, I moved the hacks file over from the old install, and things started working…. sorta.

I discovered that instead of the photos, I was just getting the date returned. Now, I’d seen that before when I originally coded this, and found that I wasn’t using the_time correctly in my code. I checked my code, though, and it looked ok. I thought maybe it was an incompatibility between WP 1.2 and 1.5. To test, I hard coded the date in my code, and it worked fine.

Long story short, I discovered that the function the_time has changed, maybe intentionally, and no longer can be used to pass the date of the current blog entry to another function. I started digging, and found that the function had changed from previous versions to this one. So….. I found the function in template-functions-general.php, and made the block for the_time look like this:

function the_time( $d = '', $echo = true ) {
        $the_time = apply_filters('the_time', get_the_time( $d ), $d);
    if ($echo) {
        echo $the_time;
    } else {
        return $the_time;

This mirrors closely the code used in the_date, so I’m pretty confident it’s safe. It does fix my problem, and barring anyone screaming and hollering, that’s good enough for me!

So, I’m patting myself on the back — finding a bug in someone else’s code, and killing it. Ahhh, ain’t open source wonderful!