[wp-hackers] Global sidebars

Rocio Valdivia rocio at mecus.es
Tue May 10 11:09:23 UTC 2011


Hi everybody!

My name is Rocío Valdivia, a spanish wordpress developer. I've just
suscribed to this mailing list, so if this email *is not supposed*  to be
here, be free to let me know ;).

I'm going straight to the point. *Drag* and drop widgets in a blog is easy
and *funny* :P, but when you are managing a WP multisite *with* hundreds of
blogs, it can be *a tedious waste of time*.

So, I have an idea. Could it be possible to have a global or network
sidebars? *T*hat is, a new submenu in the network admin panel, for example:
/wp-admin/network/widgets.php, *We can place there some global sidebars and
all the widgets that I drag an drop there would appear in all blogs with
that global sidebar activated in these themes.
*
The developers *would* be able to register as many global sidebars as they
need in the diferent themes. For example, we have 4 diferents global
sidebars registered in the funtcions.php of our themes and we have placed
them to show it in header.php, sidebar.php and footer.php (It can be
perfectly compatible with the normal registered sidebars for a*n* *unique*blog,
*be*cause they appear in /wp-admin/widgets.php).

So, if the super admin goes to: /wp-admin/network/widgets.php he *would *see
all registered global sidebars and he will be able to *drag* and drop as
many widgets *as *he wants *in the* global sidebar. *Then*, all blogs that
have register the global sidebar in the functions.php and have the call to
that sidebar in a template *would* show the widgets on it:
- Ocultar texto citado -


Example of registration and the call could be:

FUNCTIONS.PHP
<?php
register_global_sidebar( array(
        'name' => __( 'Primary Global Widget Area', 'twentyten' ),
        'id' => 'primary-global-widget-area',
        'description' => __( 'The primary global widget area', 'twentyten'
),
        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
    ) );
?>

SIDEBAR.PHP
<?php
    // A global sidebar for widgets
    if ( is_active_global_sidebar( 'primary-global-widget-area' ) ) : ?>

        <div id="primary-global" class="widget-area" role="complementary">
            <ul class="xoxo">
                <?php dynamic_sidebar( 'primary-global-widget-area' ); ?>
            </ul>
        </div><!-- #primary-global .widget-area -->

<?php endif; ?>


I think it could be very useful for theme developers and super admin
managers of WP multisites.


Rocío Valdivia
Web: http://mecus.es
Twitter: @_DorsVenabili


More information about the wp-hackers mailing list