[wp-trac] [WordPress Trac] #21430: Text widget puts a space in <h3> </h3> if title empty

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 31 18:53:25 UTC 2012


#21430: Text widget puts a space in <h3> </h3> if title empty
-------------------------------+------------------------------
 Reporter:  rulatir            |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Widgets            |     Version:  3.4.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------
Changes (by ocean90):

 * keywords:   => reporter-feedback


Comment:

 Which theme did you use? Any plugins active?

 From `default-widgets.php`:

 {{{
 class WP_Widget_Text extends WP_Widget {
         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', empty(
 $instance['text'] ) ? '' : $instance['text'], $instance );
                 echo $before_widget;
                 if ( !empty( $title ) ) { echo $before_title . $title .
 $after_title; } ?>
                         <div class="textwidget"><?php echo !empty(
 $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
                 <?php
                 echo $after_widget;
         }
 }}}

 So, there shouldn't be any title output if the title field is empty.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21430#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list