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

In this article

Outputs the content for the current Calendar widget instance.

Parameters

$argsarrayrequired
Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instancearrayrequired
The settings for the particular instance of the widget.

Source

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;
}

Hooks

apply_filters( ‘widget_title’, string $title, array $instance, mixed $id_base )

Filters the widget title.

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

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