What is the use case for the “Class” parameter in register_sidebar?

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

Related posts

1 comment

  1. 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">
    

Comments are closed.