Make WordPress Core

Ticket #10457: 10457.3.diff

File 10457.3.diff, 1.3 KB (added by nacin, 12 years ago)

Patch thanks to an idea from AaronCampbell.

  • wp-includes/default-widgets.php

     
    374374        }
    375375
    376376        function widget( $args, $instance ) {
    377                 extract($args);
     377                if ( false !== $priority = has_filter( 'widget_text', 'do_shortcode' ) )
     378                        remove_filter( 'widget_text', 'do_shortcode', $priority );
     379                extract( $args );
    378380                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    379                 $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );
     381                $text  = apply_filters( 'widget_text',  empty( $instance['text'] )  ? '' : $instance['text'],  $instance, $this->id_base );
    380382                echo $before_widget;
    381                 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
    382                         <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
    383                 <?php
     383               
     384                if ( ! empty( $title ) )
     385                        echo $before_title . $title . $after_title;
     386                echo '<div class="textwidget">';
     387                        if ( ! empty( $instance['filter'] ) )
     388                                $text = shortcode_unautop( wpautop( $text ) );
     389                        echo do_shortcode( $text );
     390                echo '</div>';
    384391                echo $after_widget;
    385392        }
    386393