diff --git a/includes/widgets/class-sp-widget-countdown.php b/includes/widgets/class-sp-widget-countdown.php index 26ad8d7d..5d02650d 100644 --- a/includes/widgets/class-sp-widget-countdown.php +++ b/includes/widgets/class-sp-widget-countdown.php @@ -16,6 +16,7 @@ class SP_Widget_Countdown extends WP_Widget { $show_venue = empty($instance['show_venue']) ? false : $instance['show_venue']; $show_league = empty($instance['show_league']) ? false : $instance['show_league']; $show_date = empty($instance['show_date']) ? false : $instance['show_date']; + $show_excluded = empty($instance['show_excluded']) ? false : $instance['show_excluded']; do_action( 'sportspress_before_widget', $args, $instance, 'countdown' ); echo $before_widget; @@ -26,7 +27,7 @@ class SP_Widget_Countdown extends WP_Widget { // Action to hook into do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' ); - sp_get_template( 'countdown.php', array( 'calendar' => $calendar, 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league, 'show_date' => $show_date ) ); + sp_get_template( 'countdown.php', array( 'calendar' => $calendar, 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league, 'show_date' => $show_date, 'show_excluded' => $show_excluded ) ); // Action to hook into do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' ); @@ -45,6 +46,7 @@ class SP_Widget_Countdown extends WP_Widget { $instance['show_venue'] = intval($new_instance['show_venue']); $instance['show_league'] = intval($new_instance['show_league']); $instance['show_date'] = intval($new_instance['show_date']); + $instance['show_excluded'] = intval($new_instance['show_excluded']); // Filter to hook into $instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'countdown' ); @@ -62,6 +64,7 @@ class SP_Widget_Countdown extends WP_Widget { $show_venue = intval($instance['show_venue']); $show_league = intval($instance['show_league']); $show_date = intval($instance['show_date']); + $show_excluded = intval($instance['show_excluded']); // Action to hook into do_action( 'sportspress_before_widget_template_form', $this, $instance, 'countdown' ); @@ -135,6 +138,9 @@ class SP_Widget_Countdown extends WP_Widget {

>

+

> +

+ get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false, 'show_thumbnail' => get_option( 'sportspress_countdown_show_thumbnail', 'no' ) == 'yes' ? true : false, ); + +if ( isset( $show_excluded ) && $show_excluded ){ + $excluded_statuses = array(); +}else{ + $excluded_statuses = apply_filters( 'sp_countdown_excluded_statuses', array( + 'postponed', + 'cancelled', + ) ); +} + if ( isset( $id ) ): $post = get_post( $id ); elseif ( $calendar ): @@ -36,10 +46,6 @@ elseif ( $calendar ): /** * Exclude postponed or cancelled events. */ - $excluded_statuses = apply_filters( 'sp_countdown_excluded_statuses', array( - 'postponed', - 'cancelled', - ) ); while ( $post = array_shift( $data ) ) { $sp_status = get_post_meta($post->ID, 'sp_status', true); if( ! in_array( $sp_status, $excluded_statuses ) ) { @@ -80,10 +86,7 @@ else: $args['meta_query'][] = [ 'key' => 'sp_status', 'compare' => 'NOT IN', - 'value' => apply_filters( 'sp_countdown_excluded_statuses', array( - 'postponed', - 'cancelled', - ) ), + 'value' => $excluded_statuses, ]; $post = sp_get_next_event( $args ); @@ -98,6 +101,13 @@ if ( $title ) $title = $post->post_title; if ( $link_events ) $title = '' . $title . ''; +$sp_status = get_post_meta($post->ID, 'sp_status', true); +$statuses = apply_filters( 'sportspress_event_statuses', array( + 'ok' => __( 'On time', 'sportspress' ), + 'tbd' => __( 'TBD', 'sportspress' ), + 'postponed' => __( 'Postponed', 'sportspress' ), + 'cancelled' => __( 'Canceled', 'sportspress' ), + ) ); ?>
@@ -128,7 +138,7 @@ if ( $link_events ) $title = '