null, 'calendar' => null, 'order' => null, 'orderby' => null, 'league' => null, 'season' => null, 'id' => null, 'title' => null, 'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false, 'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false, 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false, 'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false, 'show_logos' => 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 ): $calendar = new SP_Calendar( $calendar ); if ( $team ) $calendar->team = $team; $calendar->status = 'future'; if ( $order ) { $calendar->order = $order; }else{ $calendar->order = 'ASC'; } if ( $orderby ) { $calendar->orderby = $orderby; } $data = $calendar->data(); /** * Exclude postponed or cancelled events. */ while ( $post = array_shift( $data ) ) { $sp_status = get_post_meta($post->ID, 'sp_status', true); if( ! in_array( $sp_status, $excluded_statuses ) ) { break; } } else: $args = array(); if ( isset( $team ) ) { $args['meta_query'] = array( array( 'key' => 'sp_team', 'value' => $team, ) ); } if ( isset( $league ) || isset( $season ) ) { $args['tax_query'] = array( 'relation' => 'AND' ); if ( isset( $league ) ) { $args['tax_query'][] = array( 'taxonomy' => 'sp_league', 'terms' => $league, ); } if ( isset( $season ) ) { $args['tax_query'][] = array( 'taxonomy' => 'sp_season', 'terms' => $season, ); } } /** * Exclude postponed or cancelled events. */ $args['meta_query'][] = [ 'key' => 'sp_status', 'compare' => 'NOT IN', 'value' => $excluded_statuses, ]; $post = sp_get_next_event( $args ); endif; extract( $defaults, EXTR_SKIP ); if ( ! isset( $post ) || ! $post ) return; if ( $title ) echo '