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 registered a new sidebar and filled in the class parameter (see code), I then dropped in an Archive widget and went hunting for my "testing" class. Not there.

So what is the class parameter used for. Can I see an example?

register_sidebar(
    array(
        'name'  => __('Footer Widget One', 'wpbs-framework'),
        'id'    => 'footer-01',
        'class' => 'testing',
        'description'   => __('The first footer area', 'wpbs-framework'),
        'before_widget' => '<div class="footer-sidebar-widget">',
        'after_widget'  => '</div> <!-- end footer-sidebar-widget -->',
        'before_title'  => '<h4>',
        'after_title'  => '</h4>'
    )
);
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

If you fill class parameter to register_sidebar function then the class sidebar-{class name} gets added to the div of that sidebar in the back end.

For example if you register the sidebar using following code :

register_sidebar(
    array(
        'name'  => __('Footer Widget One', 'wpbs-framework'),
        'id'    => 'footer-01',
        'class' => 'testing',
        'description'   => __('The first footer area', 'wpbs-framework'),
        'before_widget' => '<div class="footer-sidebar-widget">',
        'after_widget'  => '</div> <!-- end footer-sidebar-widget -->',
        'before_title'  => '<h4>',
        'after_title'  => '</h4>'
    )
);

then in back end you will see the sidebar div having class 'sidebar-testing' as following

<div class="widgets-holder-wrap sidebar-testing">
share|improve this answer
    
Got it! Thank you. –  sleeper Sep 9 '13 at 9:40
    
@sleeper You are Welcome. Accept answer if it best answers for your question. –  Vinod Dalvi Sep 9 '13 at 9:47
    
I just tested that and sidebar-testing is not in the div. In fact it is nowhere in the code. This is bizarre. –  sleeper Sep 9 '13 at 9:48
    
Have you tested it in back end or in front end? –  Vinod Dalvi Sep 9 '13 at 9:49
    
Front end. My bad, I see it now (in back end). Sorry. Points coming. Why is this necessary in the backend? That is sorta misleading (to me). –  sleeper Sep 9 '13 at 9:52
add comment

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.