WP_Widget_Search::widget( array $args, array $instance )

Outputs the content for the current Search widget instance.


Description Description


Parameters Parameters

$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.


Top ↑

Source Source

File: wp-includes/widgets/class-wp-widget-search.php

	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 current theme search form if it exists
		get_search_form();

		echo $args['after_widget'];
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.