diff --git a/includes/widgets/class-sp-widget-countdown.php b/includes/widgets/class-sp-widget-countdown.php index 69e7961d..3a268fb3 100644 --- a/includes/widgets/class-sp-widget-countdown.php +++ b/includes/widgets/class-sp-widget-countdown.php @@ -19,6 +19,7 @@ class SP_Widget_Countdown extends WP_Widget { $show_excluded = empty($instance['show_excluded']) ? false : $instance['show_excluded']; $order = empty($instance['order']) ? false : $instance['order']; $orderby = empty($instance['orderby']) ? false : $instance['orderby']; + $show_status = empty($instance['show_status']) ? true : $instance['show_status']; do_action( 'sportspress_before_widget', $args, $instance, 'countdown' ); echo $before_widget; @@ -29,7 +30,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, 'show_excluded' => $show_excluded, 'order' => $order, 'orderby' => $orderby ) ); + 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, 'order' => $order, 'orderby' => $orderby, 'show_status' => $show_status ) ); // Action to hook into do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' ); @@ -51,6 +52,7 @@ class SP_Widget_Countdown extends WP_Widget { $instance['show_excluded'] = intval($new_instance['show_excluded']); $instance['order'] = strip_tags($new_instance['order']); $instance['orderby'] = strip_tags($new_instance['orderby']); + $instance['show_status'] = strip_tags($new_instance['show_status']); // Filter to hook into $instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'countdown' ); @@ -59,7 +61,7 @@ class SP_Widget_Countdown extends WP_Widget { } function form( $instance ) { - $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'calendar' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false, 'show_date' => false, 'show_excluded' => false, 'order' => '', 'orderby' => '' ) ); + $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'calendar' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false, 'show_date' => false, 'show_excluded' => false, 'order' => '', 'orderby' => '', 'show_status' => true ) ); $title = strip_tags($instance['title']); $caption = strip_tags($instance['caption']); $calendar = intval($instance['calendar']); @@ -71,6 +73,7 @@ class SP_Widget_Countdown extends WP_Widget { $show_excluded = intval($instance['show_excluded']); $order = strip_tags($instance['order']); $orderby = strip_tags($instance['orderby']); + $show_status = intval($instance['show_status']); // Action to hook into do_action( 'sportspress_before_widget_template_form', $this, $instance, 'countdown' ); @@ -162,6 +165,9 @@ class SP_Widget_Countdown extends WP_Widget {

>

+

> +

+ 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' ), - ) ); + +if ( $show_status ) { + $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' ), + ) ); + $title = $title.' ('.$statuses[ $sp_status ].')'; +} + ?>
@@ -147,7 +152,7 @@ $statuses = apply_filters( 'sportspress_event_statuses', array( } } ?> - +