WP_Widget_Calendar::widget() WordPress Method
The WP_Widget_Calendar::widget() method is used to display a calendar widget. This widget can be used to display a calendar of events, or a calendar of posts.
WP_Widget_Calendar::widget( array $args, array $instance ) #
Outputs the content for the current Calendar widget instance.
Parameters
- $args
 (array)(Required)Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
- $instance
 (array)(Required)The settings for the particular instance of the widget.
Source
File: wp-includes/widgets/class-wp-widget-calendar.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'];
		}
		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++;
	}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description | 
|---|---|
| 2.8.0 | Introduced. |