Recently, saintneko asked me whether it is better to implement a certain functionality as a plugin, or to theme it. The functionality in question is making sidebar widgets collapsible.
A seemingly simple question, but, as is often the case with “simple” questions, one with no simple answer at all.
The reason why no simple answer can be given is: There are just too many aspects involved. There is the themes at one side, the widgets at the other, and WordPress in between as middleman.
To my understanding of WordPress, a plugin alone won’t do, because there’s no common standard on how widgets in WordPress look like (in terms of their HTML/CSS), or behave (in terms of WordPress actions they trigger, and filters they apply). I’d say, WordPress is most influential of the three, but I wouldn’t give hacking WordPress the slightest consideration. The theme has some influence, too, but then, it seems the inappropriate place to add functionality that is by itself theme-unrelated.
I won’t go into much detail here (yet), beyond saying that I gave it a shot and came up with a – somewhat “quick & dirty”1 – solution. I implemented it on my site (as you can easily see), and it turned all of my widgets (that is, all with a title) into collapsible citizens at once. It takes a slight modification of a single theme file, while everything else is implemented as a plugin.
I’ll post about it in more detail soon. Till then: Stay tuned!
- at least, it is the first shot that’s “quick & dirty” [↩]