Make WordPress Core

Ticket #38614: 38614.diff

File 38614.diff, 1.5 KB (added by soulseekah, 9 years ago)

Initial patch with new filters

  • wp-includes/widgets/class-wp-widget-text.php

    diff --git wp-includes/widgets/class-wp-widget-text.php wp-includes/widgets/class-wp-widget-text.php
    index a379fd7..77f883f 100644
    class WP_Widget_Text extends WP_Widget { 
    6464                echo $args['before_widget'];
    6565                if ( ! empty( $title ) ) {
    6666                        echo $args['before_title'] . $title . $args['after_title'];
    67                 } ?>
    68                         <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
    69                 <?php
     67                }
     68
     69                /**
     70                 * Filters the wrapper of the Text widget, comes before the text.
     71                 *
     72                 * @param string         $wrapper     The widget wrapper markup, before the text.
     73                 * @param array          $instance    Array of settings for the current widget.
     74                 * @param WP_Widget_Text $this        Current Text widget instance.
     75                 */
     76                echo apply_filters( 'widget_text_wrapper_before', '<div class="textwidget">', $instance, $this );
     77
     78                echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text;
     79
     80                /**
     81                 * Filters the wrapper of the Text widget, comes after the text.
     82                 *
     83                 * @param string         $wrapper     The widget wrapper markup, after the text.
     84                 * @param array          $instance    Array of settings for the current widget.
     85                 * @param WP_Widget_Text $this        Current Text widget instance.
     86                 */
     87                echo apply_filters( 'widget_text_wrapper_after', '</div>', $instance, $this );
     88
    7089                echo $args['after_widget'];
    7190        }
    7291