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.

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

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.

share|improve this answer

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.