3

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>'
    )
);

1 Answer 1

2

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">
4
  • @sleeper You are Welcome. Accept answer if it best answers for your question. Commented Sep 9, 2013 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
    Commented Sep 9, 2013 at 9:48
  • Have you tested it in back end or in front end? Commented Sep 9, 2013 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
    Commented Sep 9, 2013 at 9:52

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.