WP_Widget_Calendar::widget()publicWP 2.8.0

Outputs the content for the current Calendar widget instance.

Метод класса: WP_Widget_Calendar{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$WP_Widget_Calendar = new WP_Widget_Calendar();
$WP_Widget_Calendar->widget( $args, $instance );
$args(массив) (обязательный)
Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instance(массив) (обязательный)
The settings for the particular instance of the widget.

Список изменений

С версии 2.8.0 Введена.

Код WP_Widget_Calendar::widget() WP 6.5.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'];
	}
	if ( 0 === self::$instance ) {
		echo '<div id="calendar_wrap" class="calendar_wrap">';
	} else {
		echo '<div class="calendar_wrap">';
	}
	get_calendar();
	echo '</div>';
	echo $args['after_widget'];

	++self::$instance;
}