• I just now changed my register_sidebar function calls so that I could register them individually and name them individually. This would make it easier to tell which sidebar I was adding widgets to.

    However, when I go to move the widgets around, the admin dashboard displays both sidebars are blank, with no widgets. This is despite the fact that the correct widgets do show up when you go to the site (!)

    So, I think the problem occurs when I’m registering the sidebars, which is the only thing that I’ve changed recently. This is my code:

    if ( function_exists('register_sidebar') ) {
        register_sidebar(array(
        	'name'=>'Blog Sidebar',
        	'id' => '1',
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '<div class="title">',
            'after_title' => '</div>',
        ));
    
        register_sidebar(array(
        	'name'=>'Single Page Sidebar',
            'id' => '2',
    		'before_widget' => '',
            'after_widget' => '',
            'before_title' => '<div class="title">',
            'after_title' => '</div>',
        ));
    
        }

    Is that right, or does it make the function recursive, or does the second one just override the first one every time, or what? What is the way I should declare two separate sidebars and be able to name them and give them IDs?

    The weird thing is that the widgets show up when the site loads, it’s just that the backend doesn’t remember that widgets are there…

    Thanks

Viewing 1 replies (of 1 total)
  • The only thing obviously different in your code compared to mine is that I use non-numerical ids – such as ‘blog_sidebar’ or ‘top_nav’. I then ensure that I replicate those ids in the sidebar files – eg:

    <div id="top_tabs" class="tabs">
    <ul>
    <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Top Tabs') ) : ?>
    
    [do stuff]
    <?php endif; ?>
    
    </ul>
    </div>

    Not sure if that’s your problem but it might be worth a try.

Viewing 1 replies (of 1 total)
  • The topic ‘Admin Dashboard is forgetting my widgets (two sidebars)’ is closed to new replies.