Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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">
   <h3>$title</h3>
      <ul>
         <li>$output</li>
      </ul>
</li>

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

share|improve this question

1 Answer 1

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:

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

Your Answer

 
discard

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.