WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 have some custom-made widgets:

echo $before_widget;
   if ( $title )
      echo $before_title . $title . $after_title;
echo $output;
echo $after_widget; 

Let's assume the $title is "Widget's Title" and the output is "Hello world".

I'm getting something like:

Widget's Title

Hello world

Now, I don't know where it comes, but there's container wrapping every one of my widgets, it looks like:

<li id="widgets-id" class="widget widget_name">

Any ideas how to change the first "li" into "section" or a "div"? :)

share|improve this question
up vote 2 down vote accepted

It's the default behavior of a dynamic sidebar to output li tags around widgets. You can override that though in the sidebar declaration.

You would do that by passing the sidebar registration the following additional arguments:

    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => "</div>"
share|improve this answer

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.