If you’re known to use widgets, you may want to keep your eyes open for a small bug which I’ve come across on this blog while trying to update my newest theme.
This quirk is hard to describe, but I’ll do my best…
First, the theme I’m working on features 3 sidebars: One with a custom name, Top Side, and two using the ‘Sidebar %d’ method (i.e. Top Side, Sidebar 1 and Sidebar 2).
I created a custom text block for the first widget and added it to ‘Top Side’. So far, so good. Tweaked the functions.php file in order to remove the before and after widget <li> code and all continued to be right with the world.
Then, I decided to add a widget to the first sidebar and that’s when the sky fell down on my head.
All the widgets disappeared from view in both ‘Top Side’ and ‘Sidebar 1′, although the widgets are still registering as active in WordPress. I was able to remove the original text widget by adding the pages widget to ‘Top Side’, but I’m still unable to remove or update Sidebar 1 — not even when I add another widget to it. See the screen shot.
You’ll note that although it says there is 1 active widget in Sidebar 1, there aren’t actually any widgets shown which means I can’t edit or delete it from the sidebar.
Now, for ‘Top Side’, I’m shown the page widget, but when I remove it, I’m told there are -1 widgets. How exactly is it possible to have less than zero widgets?
As a result, saving the changes means that the pages widget still shows up under Top Side and there’s no way to get rid of it or assign it to a different sidebar.
Looks like I’ll have to unbork this from phpMyAdmin. But, just a head’s up if you’re planning to widgets, do so with caution. There may be a bug lurking for those themes which use more than one sidebar.
UPDATE: Playing around with the theme a bit more, it appears that for some reason, Top Side seems to be stealing all the widgets, although they seem to be properly assigned in WordPress and display accordingly on the site. This will probably be more of a headache for theme authors and some unsuspecting users who don’t understand why they add a widget to Sidebar 2, but all of their widgets are appearing under Sidebar 1.
Look closely at the screen shot above. Although it says there are 0 widgets in ‘Top Side’, there are clearly 3 widgets (which I actually assigned to Sidebar 1) showing up.
The solution, in case you care to know, is to manually register all of your sidebars individually, even if a couple of them will be using the same format. (i.e. no mixing of