I've got a basic text widget and, outside the standard <div class="textwidget"> wrapper there is a <li id="text-5" class="widget widget_text"> (which I have not added when creating the sidebar in functions.php or added when adding a text widget from the dashboard).

i.e. the full code looks like this:

<li id="text-5" class="widget widget_text">
  <div class="textwidget">
    <my content>

I'm at a loss where this li comes from. Any idea why and how I can get rid of it?

  • can you show you sidebar.php and the function you're using in your functions.php to create the widget areas please? – bigmadwolf Sep 17 '15 at 22:35

I think WordPress widgets create li tags on default. If you want the bullet points removed you could fix that with a css approach.

.widget li {
  list-style: none;
  • +1 for the li tags on default. That was throwing me. After I removed them I didn't need the CSS. – Snowcrash Sep 18 '15 at 13:30

This seems to occur when you leave out 'before_widget' and 'after_widget' in the array when you register your sidebar/widget. I had the same problem and fixed it by leaving them blank.

        'name' => 'Footer Widget',
        'id' => 'footer-widget-1',
        'class' => 'footer-widget',
        'description' => 'Footer widget',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h3>',
        'after_title' => '</h3>',

There is a truble with your wordpress theme in file "functions.php" there is a function for creating sidebar, there you have to add this code

    'before_widget' => '<aside id="%1$s" class="di-widget %2$s">',
    'after_widget'  => '</aside>',
    'before_title'  => '<h3 class="di-widget-title">',
    'after_title'   => '</h3>',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.