WP_Widget_Calendar::widget
Outputs the content for the current Calendar widget instance.
Method of the class: WP_Widget_Calendar{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WP_Widget_Calendar = new WP_Widget_Calendar(); $WP_Widget_Calendar->widget( $args, $instance );
- $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.
Changelog
| Since 2.8.0 | Introduced. |
WP_Widget_Calendar::widget() WP Widget Calendar::widget code WP 7.0
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;
}