WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

It like module of joomla.

What can we do ? override all default widget ?

share|improve this question
What is a suffix class? – toscho Jun 7 '13 at 10:53
Why do you need to add a class? There should already be markup enough to target the widget with style rules. – s_ha_dum Jun 7 '13 at 13:35
i want display it in different styles. and only change the class suffix instead of editing css – Quang Trung Nguyen Jun 7 '13 at 13:55

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

(Depending on your template) Hope this helps someone!

share|improve this answer

The style class will effect on your frontend where you display the widget Please go fo this link

share|improve this answer
How does that answer the question? – toscho Jun 7 '13 at 12:51
you can see there is a option for class name.you add your class and write css according to that class $widget_ops = array('classname' => 'RandomPostWidget', 'description' => 'Displays a random post with thumbnail' ); – Pradipta Sarkar Jun 7 '13 at 12:57
Please take some time to elaborate on the answer-- edit it, not just comment. As is, I very badly want to flag this as "link only" or even as "not an answer" but I rather see you edit it. – s_ha_dum Jun 7 '13 at 14:17

Your Answer


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.