Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my current theme version, I'm registering sidebars with names. However, in previous versions, I only had one sidebar and registered it without a name like so...

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'before_widget' => '<div class="menu side %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h4>',
        'after_title' => '</h4>',
    ));

But now in my updated theme, I register several sidebars and give them all a name. However, when I update the old theme to the latest version, the sidebar widget that was registered without a name is seemingly getting arbitrarily assigned to one of the new "named" sidebars, but not the one I need it to. I need that unmamed sidebar widget to be reassigned to the one named "Sidebar" in the updated theme.

Here are my new sidebar registrations...

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Featured_Home',
        'before_widget' => '<div class="featured-home">',
        'after_widget' => '</div>',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Featured_Inside',
        'before_widget' => '<div class="featured-inside">',
        'after_widget' => '</div>', 
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Featured_Category',
        'before_widget' => '<div class="featured-category">',
        'after_widget' => '</div>',
        'before_title' => '<h4>',
        'after_title' => '</h4>',
    ));

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Sidebar',
        'before_widget' => '<div class="menu side %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h4>',
        'after_title' => '</h4>',
    ));

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Home_PreFooter',
        'before_widget' => '<div class="footer-pre-home">',
        'after_widget' => '</div>',
        'before_title' => '<h4>',
        'after_title' => '</h4>',
    ));

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Inside_PreFooter',
        'before_widget' => '<div class="footer-pre-inside">',
        'after_widget' => '</div>',
        'before_title' => '<h4>',
        'after_title' => '</h4>',
    )); 
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Try moving registration of Sidebar sidebar to be first.

I had an impressions that widget should move to that special "unassigned" area in this situation, but maybe that only works between themes, not changes in same theme.

share|improve this answer
    
I think you are right Rarst. Thanks for the help. –  Scott B Sep 14 '10 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.