Taming WP Widgets

Sometimes it’s the littlest things that can make my day. . .

For, oh, about 6 months I’ve been trying to figure out how the heck to use different WP widget-ized sidebars on different WP templates (within a single WP install). Last fall, for Steve’s class, I spent one afternoon beating my head against this wall before deciding that maybe this just wasn’t a WP customization that I was meant to master.

But, this week, with Faculty Academy around the corner, I set out to do some more tweaking to the FA site (running in WP, natch), and decided I was going to master the WP multiple sidebar dilemma or die trying.

Lo and behold, after a few hours (!) of searching and tweaking, I came across this site, with very specific instructions about not only how to create the different sidebars, but how to place them on different templates.

Not surprisingly, the part that was holding me up actually ended up being a really simple fix. If I had an iota of PHP or programming language, I probably would have figured it out in 15 seconds. Basically, I had figured out how to create the additional sidebars; I had duplicated sidebar.php so that I could call the sidebars differently. But I couldn’t figure out what I needed to do with the get_sidebar command in the main template to point to a different version of the sidebar when I wanted it. The solution was to simply bypass the get_sidebar function altogether and replace it with a basic PHP include. Doh!

But it didn’t end there. I quickly realized the other challenge of using multiple sidebars — how to duplicate widgets on different sidebar versions. Out of the box, widgets can only be placed on one sidebar. Enter a nifty plugin called JAW Duplicate Plugin, which allows me to duplicate widgets at will and place them on different sidebar versions.

Cool!

I’m pretty happy that I figured this out. Most of my work life these days involves attending really long meetings and tracking administrative and budget information. I actually enjoy a lot of the administrative work, but sometimes I long for a creative challenge. I rarely seem to get under the hood of anything, so it’s fun to get “back in the game” for a few hours — and to actually be successful.

Ultimately, however, I do think that this whole aspect of widgets needs to be rethought. The solution I’ve got, while it works, is not ideal. For one thing, I’ve now got multiple templates that are, by and large, exactly the same except for their sidebar includes. If I make any modifications, I’ve got to remember to make them on every version. Plus, while it’s cool that I can duplicate the widgets, they exist as individual content chunks. If I want to make a change to them, I need to change each version.

It seems like there should be a much easier way to do this. . .