Is there a function to remove the inner div that gets inserted when using a text widget?
In the functions.php to register the widget areas I use
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Page Top',
'id' => 'Page Top Box',
'description' => 'Page Top Box',
'before_widget' => '<div class="page-top">',
'after_widget' => '</div>',
'before_title' => '<h2 class="page-top-title">',
'after_title' => '</h2>',
));
Using the text widget this is what renders as code
<div class="page-top"><h2 class="page-top-title">About Me</h2>
<div class="textwidget"><p>Nam posuere felis ac urna. Vestibulum tempor vestibulum urna. Nullam metus. Vivamus ac purus. Nullam interdum ullamcorper libero. Morbi vehicula imperdiet justo. Etiam mollis fringilla ante. Donec et dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Etiam mi libero, luctus nec, blandit ac, rutrum ac, lectus.</p></div>
</div>
I want to remove the div (<div class=“textwidget”>) from around the widget. In my searching, all I have found is a hack to the core file wp-includes>default-widgets.php. I don’t want to hack core files that will probably get updated at some point. The function in the default-widgets.php file that creates the div is
function widget( $args, $instance ) {
extract($args);
$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$text = apply_filters( 'widget_text', $instance['text'], $instance );
echo $before_widget;
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
<div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
<?php
echo $after_widget;
}