'widget_countdown widget_sp_countdown', 'description' => __( 'A clock that counts down to an upcoming event.', 'sportspress' ) ); parent::__construct('sp_countdown', __( 'Countdown', 'sportspress' ) . ' (' . __( 'SportsPress', 'sportspress' ) . ')', $widget_ops); } function widget( $args, $instance ) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base); $team = empty($instance['team']) ? null : $instance['team']; $id = empty($instance['id']) ? null : $instance['id']; $show_venue = empty($instance['show_venue']) ? false : $instance['show_venue']; $show_league = empty($instance['show_league']) ? false : $instance['show_league']; echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; // Action to hook into do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' ); sp_get_template( 'countdown.php', array( 'team' => $team, 'id' => $id, 'show_venue' => $show_venue, 'show_league' => $show_league ) ); // Action to hook into do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' ); echo $after_widget; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['team'] = intval($new_instance['team']); $instance['id'] = intval($new_instance['id']); $instance['show_venue'] = intval($new_instance['show_venue']); $instance['show_league'] = intval($new_instance['show_league']); // Filter to hook into $instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'countdown' ); return $instance; } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'team' => '', 'id' => '', 'show_venue' => false, 'show_league' => false ) ); $title = strip_tags($instance['title']); $team = intval($instance['team']); $id = intval($instance['id']); $show_venue = intval($instance['show_venue']); $show_league = intval($instance['show_league']); // Action to hook into do_action( 'sportspress_before_widget_template_form', $this, $instance, 'countdown' ); ?>

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

'sp_event', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'show_option_all' => __( '(Auto)', 'sportspress' ), 'values' => 'ID', 'class' => 'widefat', 'show_dates' => true, 'post_status' => 'future', 'filter' => 'sp_team', ); if ( ! sp_dropdown_pages( $args ) ): sp_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) ); endif; ?>

>

>