Add title option to search widget. Props hakre. fixes #9756
git-svn-id: https://develop.svn.wordpress.org/trunk@11274 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5406d9d5fa
commit
2a25e50450
@ -179,13 +179,33 @@ class WP_Widget_Search extends WP_Widget {
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
echo $before_widget;
|
||||
if ( $title )
|
||||
echo $before_title . $title . $after_title;
|
||||
|
||||
// Use current theme search form if it exists
|
||||
get_search_form();
|
||||
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
|
||||
$title = $instance['title'];
|
||||
?>
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
$new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user