'widget_sp_event_blocks', 'description' => __( 'A list of events.', 'sportspress' ) ); parent::__construct('sp_event_blocks', __( 'SportsPress Event Blocks', 'sportspress' ), $widget_ops); } function widget( $args, $instance ) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $id = empty($instance['id']) ? null : $instance['id']; $status = empty($instance['status']) ? 'default' : $instance['status']; $number = empty($instance['number']) ? null : $instance['number']; $order = empty($instance['order']) ? 'default' : $instance['order']; $show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link']; echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; sp_get_template( 'event-blocks.php', array( 'id' => $id, 'status' => $status, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) ); echo $after_widget; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['id'] = intval($new_instance['id']); $instance['status'] = $new_instance['status']; $instance['number'] = intval($new_instance['number']); $instance['order'] = strip_tags($new_instance['order']); $instance['show_all_events_link'] = $new_instance['show_all_events_link']; return $instance; } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) ); $title = strip_tags($instance['title']); $id = intval($instance['id']); $status = $instance['status']; $number = intval($instance['number']); $order = strip_tags($instance['order']); $show_all_events_link = $instance['show_all_events_link']; ?>

'sp_calendar', 'show_option_all' => __( 'All', 'sportspress' ), 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat', ); if ( ! sp_dropdown_pages( $args ) ): sp_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) ); endif; ?>

__( 'Default', 'sportspress' ), 'name' => $this->get_field_name('status'), 'id' => $this->get_field_id('status'), 'selected' => $status, 'class' => 'sp-event-status-select widefat', ); sp_dropdown_statuses( $args ); ?>

>