WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

Your Answer


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.