Okay, fine, not all widgets are used in sidebars. I’m going to use sidebar here to make my life simpler and trust you know what I mean. After reading Trac 17979 and Jane’s post on Wherefore Art Thou, Widgets? I had some thoughts.
Right now, when you switch themes, if the sidebar doesn’t match a new sidebar area, the widgets get dumped into ‘Inactive’, which makes if difficult if you want to switch themes for testing. Kbitzing on this on Twitter, like we do a few of us started kicking around ideas, most of which the
UI team folks in dev-chat had already gone through.
My first draft was pretty straight forward:
But then Jane pointed out:
Which is true. I have over 20 available widgets here, and that list would get pretty damn long. While a list of checkboxes strikes me as less pretty, you would be easier able to manage this:
In either case, you’d want the widgets ‘box’ where they’re listed to be scrollable. I’m fairly sure you could make an auto-resizing box that grew and shrank by height depending on how tall your window is and then allow for scrolling the rest of the way.
At this point, we’ve reached the end of my practical knowledge. I know that menus are stored in the
wp_posts table as a custom post-type called
nav_menu_item. And then the actual data is over in the
wp_postmeta table, where the
post_id is the same as the ID from the posts table, and the _menu_item_* settings are where the magic happens.
On the other hand, widgets are stored in the table wp_options and not in the same way. They’re in one master field
sidebars_widgets which stores all your information for widgets, which ‘sidebar’ they’re in, active or not. Each individual widget stores itself in
Clearly it would be a bad idea to attempt to save the widget data in post-types, so we’d have to have some way to reach back and get the data. But if it were possible to toss the
sidebars_widgets data over into the posts table, then they’d be brought over when you ran an export/import of your site much like menus are, which would make moving people off of MultiSite and over to their own site a heck of a lot easier, wouldn’t it?
This is as far as my thinking takes me, but it’s something I’d love to play with.