• I have a theme that displays just fine out of the box. It defaults to showing archives and categories in a vertical list in the left sidebar by default.

    However, when I add a Text Widget to the mix, it destroys everything. After messing with Firebug I found that it’s because the text widget wraps the contents of the widget in a special class called “textwidget”.

    If this “textwidget” class style is REMOVED the site shows just fine.

    How do I get text widgets to stop adding this extra div? I did a search in my widgets.php file in wp-includes and I didn’t find the term “textwidget” anywhere…so I dunno how it’s assigning that class to the contents of every text widget.

    Very annoying >:0<

Viewing 8 replies - 1 through 8 (of 8 total)
  • umm..

    If this “textwidget” class style is removed …

    How do I get text widgets to stop adding this extra div?

    do you want to remove the div or the styling? theyre not the same thing.

    have you thought about just editing your stylesheet to remove the styling for that class?

    I have been looking for the same thing (to remove the div that wraps around the content in the text widget). For example, I want to manually input HTML code of a list of things, so I have added ul before widget and closing ul after widget, now all I would want to do is in the text widget input the li’s but these li’s are being automatically wrapped with that div so it would be cool If i could just stop that div appearing completely.

    I understand if I change the core file…I will have to do it again and again every time i will upgrade wordpress, so wondering is there any simple way of doing this and avoiding to re-change the code once i upgrade my wordpress?

    I’m also having problems with the textwidget. Text is moved about 50 pixels from the left part of the widget.

    So I noticed the <div class=”textwidget”>here the content of the widget</div> and I was hoping I could edit the stylesheet to fix this. However, I can’t find the class “textwidget” in the stylesheet (I’m using theme Lifestyle from studiopress.com). And as NameNexus wrote, then you have to edit it over and over again when a new version of wordpress (or the theme) comes out.

    Is there perhaps a plugin that you can use to put text in de sidebar?

    I am also having the same problem, I can’t seem to find <div class=”textwidget”> in the style.css either

    If it isn’t in the stylesheet, just add it. There are more classes that ar not in the style.css of the theme. You can add anything you like to style.css of your theme.

    In the functions.php file find this…

    if ( function_exists('register_sidebar') ) {
    	register_sidebar(array(
    		'before_widget' => '<li id="%1$s" class="widget %2$s">',
    		'after_widget' => '</li>',
    		'before_title' => '<h2 class="widgettitle">',
    		'after_title' => '</h2>',
    	));
    }

    And take out the list elements.

    (You could go deeper down and have an if statement to just apply this to text widgets if you want)

    I ran into this same exact issue just 2 days ago. I had a custom sidebar and modified the before/after parameters, but the contents of the text widget was still enclosed in a div tag with a class of “textwidget”.

    I looked around and found the culprit: wp-includes/default-widgets.php (line 383):

    <div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>

    Remove that opening and closing div tag and you should be all set. Edit as necessary, always make a backup, and remember that an auto-upgrade will probably overwrite that file.

    I’m still having a problem. I’m using the text widget for some code I want in a certain position. I can see the class of the text widget, and I can style it how I wish in CSS. in fact, all of my dynamic sidebar widgets are styled with a header and box around them.

    HOWEVER, I have some other stuff I want to put in my sidebar, and everyone says to drop the code into a text widget. So that will be my second text widget, but it will have the same class name, and I don’t want to have it styled like the other boxes. I want to do some other things outside of the sidebar box format.

    So, how can I get html into a dynamic sidebar without using a text widget. OR, how can I used a second text widget and style it seperately from the first one, (or just remove all styling from the widget itself.

    site is https://www.kidreviewer.com

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to Stop Text Widgets from Adding “TextWidget” Class?’ is closed to new replies.