When I write a quote in the text widget and displayed the text is wrapped as "My text...". I would like to remove the div and put simply "My text...". without using jquery.

For Example: Current output

<div class="container">
   <div class=“textwidget”>
       My text...

Required output:

<div class="container">
    My text...

This is the actual code:

<div class="container">
    <?php dynamic_sidebar('text_show');?> 

2 Answers 2


More than likely this is an issue with the register_sidebar() call in functions.php.

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

'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget'  => '</li>',

Note: This will alter all of the widgets within the sidebar, not just the TextWidget.

  • 3
    This doesn't actually work. The div we're talking about is inside that li element. Commented Oct 5, 2017 at 17:35

What you want is probably better to do with css by applying a display:inline; style to the specific widget. something like

#id.textwidget {

Where "id" is the id attribute of the widget. If you don't have one you should change your sidebar registration code to create one.

I don't think it is very likely that you will want such a behaviour on all your text widgets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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