My website has started off the new year by breaking in a puzzling way. All the widgets on my homepage that are created with PHP are gone. (This applies to individual post pages too.) At first I thought PHP was broken - but no, I was using my own PHP5, and I didn’t change anything. So I fell back on the Dreamhost install of PHP 4.4.2, and that didn’t fix it. I changed it to the Dreamhost install of PHP 5.1.2, which is a slightly newer version than the one I was using (5.0.9), but that didn’t fix anything either. What’s really weird is that my admin side is working fine, and other websites I run that use PHP are fine. A says that if I didn’t change anything, then Dreamhost must have - but I can’t figure it out. It seems like if it’s only affecting the produced version of my journal (and the actual layout is fine, that is also constructed by PHP, it’s just the widgets that aren’t working), then it must be something in the journal design? Right? Hello? I’m so confused.
Added: Also, when I made this post, WordPress asked me if I was sure I wanted to add this post. I said yes, and it posted, and it was fine. But now I’m thinking something is up with my WordPress (which is self-installed 2.0.4), so I’m going to upgrade…
Resolved: Holy crapola. Apparently all of my King Text widgets got set to not run PHP; I have no idea why I didn’t figure this out faster. I also discovered an issue with WP 2.0.5 that caused WordPress to ask me for confirmations for some things; it turns out this is related to FastCGI and can be fixed with the WordPress 2.0.5 Tuneup plugin.
I did it! Almost entirely by myself, with just a bit of help from Mark of Weblog Tools Collection, I widgetized my design. I now have 13 instances of the King Text plugin running, each containing the code from my original sidebar. I was not able to find a way around the problem of the title falling inside the widget, so I had to stick with modifying the plugin code, but the King Text plugin accepts both PHP and HTML so I can put whatever I like in there. If I want to add additional widget plugins, I will have to edit those too, but for now I got everything running how I want it.
I did have to make one sacrifice: the sidebars are now fixed-width rather than liquid. This is because the percent sign I was using for the liquid layout was getting tossed out by the PHP running on the plugin. It’s not a huge deal, I can always adjust the width if necessary, but it isn’t quite perfect.
But damn, I did what I want, how cool is that?!
This will probably not be of interest to anyone who isn’t into PHP, WordPress, and/or Sidebar Widgets.
I am having bizarre results trying to widgetize my design. The biggest concern I have is that I need the widget title to be outside the $before_widget code. I figured out how to do this by altering widgets.php and rearranging the order to be $before_title, $title, $after_title, $before_widget - but this is not an ideal solution, for a few reasons. First of all, it means I’m messing with stuff that wasn’t designed to be messed with by the likes of me! It means I’m slightly changing the code of the widget authors, and I don’t want to to do that. I would be just fine with only using text-input widgets that run PHP, because then I could just copy the code directly from the existing sidebar rather than fussing with various types of widgets.
I want to widgetize my design (which is originally an open-source design by Christopher Ditto, but I have modified it a lot, so I’m calling it my design) for a couple of reasons. First, I don’t like having the second sidebar’s code buried in the footer. Second, there are great big chunks of tables and whatnot that come before and after each section, to make the pretty little boxes with the funky corners, and I’d like to not have to look at that every time I want to edit my code. I suppose I could do it by using includes…I’ll have to give that a try, it will at least get things more tidy if I can’t actually use the widget functions.
I got the sidebars installed and working - I figured out how to have two of them, etc. - but in addition to not placing the title where I want it, the boxes are just coming out wrong. I don’t know if this is a result of the default code on each widget, or what - but I’m getting repeated top corners, lines extending too far, and other weird stuff that shouldn’t be happening, since I’ve pulled the before/after code straight from the existing sidebar, which works fine.
And this is totally weird. While I was messing around with widgets.php, a little “www” appeared in the upper left corner of both my design and the WordPress admin screens. I have no idea where it came from or why it was there. When I went back to a clean, unedited copy of widgets.php, it went away. I was also experiencing failures in functions.php whenever the Sidebar Widgets plugin was deactivated - I had to rename functions.php to something else just so I could use the admin side. Additionally, there were gaps between the section titles and the boxes - I don’t know where those came from, but I wouldn’t be surprised if it was related to whatever was making the boxes come out funny.
I seem to remember seeing someone who offered to widgetize any theme, for a fee. Part of me wants to do it myself, but part of me is so clueless about how to fix these errors that I’m considering passing it off to someone. I can’t figure out what site offered it, though, so for now I’m stuck doing it myself.