Wrap all default widget into div tag

I want wrap all default widget into a div tag, so i can add a suffix class to define style for each widgets

<div class="suffix-class">
 // widget
</div>

And in widget form, we have a input field to input this class.

Read More

It like module of joomla.

What can we do ? override all default widget ?

Related posts

2 comments

  1. In the register_sidebar() call in functions.php.

    Look for before_widget and after_widget and modify as appropriate. The code below is the default usage.

    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget'  => '</li>',
    
  2. I see this uestion is kind of old, but it also doesn’t seem to have been answered. For anyone who wants to do this, I don’t know how to do it via the template/code but there is a WordPress plugin that lets you do it http://wordpress.org/plugins/widget-css-classes/ . It works just like joomla so your widget will be like.

    <div class="widget suffix-class">
     // widget
    </div>
    

    (Depending on your template) Hope this helps someone!

Comments are closed.