On this page
WP_Widget_Search::widget( array $args, array $instance )
Outputs the content for the current Search widget instance.
Parameters
$argsarray Required-
Display arguments including
'before_title','after_title','before_widget', and'after_widget'. $instancearray Required-
Settings for the current Search widget instance.
Source
File: wp-includes/widgets/class-wp-widget-search.php. View all references
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
echo $args['before_widget'];
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
}
// Use active theme search form if it exists.
get_search_form();
echo $args['after_widget'];
}
Hooks
- apply_filters( 'widget_title',
string $title ,array $instance ,mixed $id_base ) -
Filters the widget title.
Related
Uses
| Uses | Description |
|---|---|
| get_search_form() wp-includes/general-template.php | Displays search form. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget_search/widget