WordPress.org

Make WordPress Core

Ticket #9756: 9756.diff

File 9756.diff, 1.2 KB (added by Denis-de-Bernardy, 4 years ago)

give credits to hakre

  • wp-includes/default-widgets.php

     
    179179 
    180180        function widget( $args, $instance ) { 
    181181                extract($args); 
     182                $title = apply_filters('widget_title', $instance['title']); 
     183 
    182184                echo $before_widget; 
     185                if ( $title ) 
     186                        echo $before_title . $title . $after_title; 
    183187 
    184188                // Use current theme search form if it exists 
    185189                get_search_form(); 
    186190 
    187191                echo $after_widget; 
    188192        } 
     193         
     194        function form( $instance ) { 
     195                $instance = wp_parse_args( (array) $instance, array( 'title' => '') ); 
     196                $title = $instance['title']; 
     197?> 
     198                <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> 
     199<?php 
     200        } 
     201         
     202        function update( $new_instance, $old_instance ) { 
     203                $instance = $old_instance; 
     204                $new_instance = wp_parse_args((array) $new_instance, array( 'title' => '')); 
     205                $instance['title'] = strip_tags($new_instance['title']); 
     206                return $instance; 
     207        }        
     208         
    189209} 
    190210 
    191211/**