I am using the following to register a widget area:

if ( function_exists('register_sidebar') )
    register_sidebar( array(
    'name' => __( 'Footer Widgets', 'hex'),
    'id' => 'footer-widgets',
    'class' => 'footer-widgets',
    'description' => __( 'Widgets will appear in the blog, between the end of content and footer', 'hex' ),
    'before_widget' => '<li class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>'
) );

And both id and class are ignored, what I get is only the widgets themselves - the top element in the widget area is the <li>

I know I can simply wrap it in the index.php, where the widgets show, with a div, but isn't this suppose to do it?

1 Answer 1


The id parameter in register_sidebar is not directly related to the html output. It is used to identify each sidebar when the $widget_object is built.

The class should be added to the before_widget markup.

http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/widgets.php#L1128 is where the class gets parsed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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