[wp-testers] Widgets in 2.2

Krusty Ruffle krustyruffle at rustykruffle.com
Wed May 16 02:54:30 GMT 2007


I tried to send this a couple of times through the last week, but my email
was mis-configured and it didn't go through, I know it's a little late now,
but if someone could look at this and tell me if something was wrong on my
end I would appreciate it greatly.

I've been using WP 2.1.3 to slowly develop a theme. In the theme I have the
following lines of code inside an init function that that is included from
functions.php and runs immediately after inclusion:

        // Register our sidebars with SBM/Widgets
        if ( function_exists('register_sidebars') ) {
            register_sidebar(array('name' => 'header', 'before_widget' =>
'<span id="%1$s" class="widget %2$s">','after_widget' => '</span>'));
            register_sidebars(2, array('before_widget' => '<li id="%1$s"
class="widget %2$s">','after_widget' => '</li>'));
            register_sidebar(array('name' => 'footer', 'before_widget' =>
'<span id="%1$s" class="widget %2$s">','after_widget' => '</span>'));

        }


That works with both the SBM and the widgets plugin in 2.1.3, but loading it
up in 2.2RC1 it fails to give me a block for the header bar, and, although
it does give me a block for the footer bar, and drag N drop appears to work,
only sidebar-1 and sidebar-1 actually get any changes made to them when the
settings are saved.

Now that I'm up to 2.2 released I've found that if I change the above lines
to this:

        // Register our sidebars with SBM/Widgets
        if ( function_exists('register_sidebar') ) {
            register_sidebar(array('name' => 'header', 'before_widget' =>
'<span id="%1$s" class="widget %2$s">','after_widget' => '</span>'));
            register_sidebar(array('name' => 'sidebar-1', 'before_widget' =>
'<li id="%1$s" class="widget %2$s">','after_widget' => '</li>'));
            register_sidebar(array('name' => 'sidebar-2', 'before_widget' =>
'<li id="%1$s" class="widget %2$s">','after_widget' => '</li>'));
            //register_sidebars(2, array('before_widget' => '<li id="%1$s"
class="widget %2$s">','after_widget' => '</li>'));
            register_sidebar(array('name' => 'footer', 'before_widget' =>
'<span id="%1$s" class="widget %2$s">','after_widget' => '</span>'));

        }

Then everything works, the admin interface is still a bit odd, Default
Sidebar box floating outside of it's container, but I can live with it.

Does the default widget implementation not support register_sidebars()
properly, or is it maybe because I mixed numbered sidebars in the middle of
named ones?
I haven't tested this with either plugin yet, but I though you guys might
know more about it than I do.


More information about the wp-testers mailing list