WP_Widget_Search::widget()
Outputs the content for the current Search widget instance.
Method of the class: WP_Widget_Search{}
Hooks from the method
Return
null
. Nothing (null).
Usage
$WP_Widget_Search = new WP_Widget_Search(); $WP_Widget_Search->widget( $args, $instance );
- $args(array) (required)
- Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
- $instance(array) (required)
- Settings for the current Search widget instance.
Changelog
Since 2.8.0 | Introduced. |
WP_Widget_Search::widget() WP Widget Search::widget code WP 6.6.2
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']; }