3

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...
   </div>
</div>

Required output:

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

This is the actual code:

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

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.

  • This doesn't actually work. The div we're talking about is inside that li element. – certainlyakey Oct 5 '17 at 17:35
0

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

#id.textwidget {
  display:inline;
}

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, privacy policy and cookie policy

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