diff --git a/admin/templates/countdown.php b/admin/templates/countdown.php index b8c6422e..8ce0ff63 100644 --- a/admin/templates/countdown.php +++ b/admin/templates/countdown.php @@ -8,18 +8,10 @@ if ( !function_exists( 'sportspress_countdown' ) ) { if ( $id ): $post = get_post( $id ); else: - $options = array( - 'post_type' => 'sp_event', - 'posts_per_page' => 1, - 'order' => 'ASC', - 'post_status' => 'future', - 'meta_query' => array(), - ); + $args = array(); if ( isset( $args['team'] ) ) - $options['meta_query'][] = array( 'key' => 'sp_team', 'value' => $args['team'] ); - - $posts = get_posts( $options ); - $post = array_pop( $posts ); + $args = array( 'key' => 'sp_team', 'value' => $args['team'] ); + $post = sportspress_get_next_event( $args ); endif; $output = ''; diff --git a/admin/widgets/countdown.php b/admin/widgets/countdown.php index 496b49c2..05e6955a 100644 --- a/admin/widgets/countdown.php +++ b/admin/widgets/countdown.php @@ -34,7 +34,7 @@ class SP_Widget_Countdown extends WP_Widget {

-

+

'sp_event', @@ -48,13 +48,13 @@ class SP_Widget_Countdown extends WP_Widget { 'post_status' => 'future', ); if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_event', __( 'Add New Event', 'sportspress' ) ); + sportspress_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) ); endif; ?>

> -

+