Personally I used the following approach to have an "persistent sidebar" globally activated for all blogs:
I tweaked only a bit the function dynamic_sidebar() in widgets.php (inside mu-plugins directory), without touching the queries:
AFTER:
function dynamic_sidebar($name = 1) {
global $registered_sidebars, $registered_widgets;
ADD:
wp_sidebarstart();
AFTER:
if ( empty($sidebar) || !is_array($sidebars_widgets[$index]) || empty($sidebars_widgets[$index]) )
{
ADD:
wp_sidebarcustom($name);
wp_sidebarend();
return true;
BEFORE:
return $did_one;
ADD:
wp_sidebarend();
What happens is the following:
- Whatever you put in your function "wp_sidebarstart()" will ALWAYS be shown at the beginning of the sidebar (after starting <ul>
)
- Whatever you put in your function "wp_sidebarend()" will ALWAYS be shown at the end of the sidebar (before ending </ul>
)
- Whatever you put in your function "wp_sidebarcustom()" will be shown INSTEAD OF default sidebar content, only if user does not customize widgets, and NOT shown, if user customize widgets.
Therefore we will have the following schema:
<ul>
CustomSideBarStart (Always)
....
CustomSideBarContent /or/ CustomWidgets
....
CustomSideBarEnd (Always)
</ul>