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.

Okay, I'm sure there is an simple explanation for this problem... it's just that I can't see it right now.

Here is my code adding widget sidebars:

add_action('widgets_init', 'starter_register_sidebars');

function starter_register_sidebars() {

register_sidebar(array(
    'id' => 'sidebar',
    'name' => __('Sidebar'),
    'description' => 'The first (primary) sidebar.',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h4 class="widgettitle">',
    'after_title' => '</h4>',
    ));

register_sidebar(array(
    'name' => __('Main Sidebar'),
    'id' => 'sidebar-1',
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => "</aside>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ));

}

So when I go the admin widget area it tells me: 'Drag widgets from here to a sidebar on the right to activate them'

But there is not sidebar on the right created by the above code... I've looked at a couple of other themes at what they do, and it's not obvious what they are doing differently from me

share|improve this question

1 Answer 1

Looks like the problem is with the id's.

Try putting some unique names.
For example, this doesn't works in TwentyEleven, as it registers a sidebar with the same ID:

'name' => __('Main Sidebar'),
'id' => 'sidebar-1',

From the Codex:

id - Sidebar id - Must be all in lowercase, with no spaces (default is a numeric auto-incremented ID).

share|improve this answer
    
Thanks for the response but that hasn't had any effect. I've now cut and paste the entire twenty eleven register_sidebar code and that isn't displaying in the widget admin area either as it would have done if twenty eleven was the active theme. This is a bit annoying but I'm sure answer is just a line of code away. –  AndW Jul 15 '12 at 6:20
1  
So, it seems to me that the problem is not contained in the code you posted... –  brasofilo Jul 15 '12 at 13:47
    
you were right, it is - oops –  AndW Jul 21 '12 at 16:08

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.