3

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>',
    )); 
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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