From fa7acb70c3f03db22d501203f11b8aba2f5923b5 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 9 Apr 2016 01:03:50 +1000 Subject: [PATCH] Add more parameters to next event function --- includes/sp-core-functions.php | 20 ++++++++++---------- templates/countdown.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/sp-core-functions.php b/includes/sp-core-functions.php index 72c217ba..ef24b9d6 100644 --- a/includes/sp-core-functions.php +++ b/includes/sp-core-functions.php @@ -1271,16 +1271,16 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) { if ( !function_exists( 'sp_get_next_event' ) ) { function sp_get_next_event( $args = array() ) { - $options = array( - 'post_type' => 'sp_event', - 'posts_per_page' => 1, - 'order' => 'ASC', - 'post_status' => 'future', - 'meta_query' => $args, - ); - $posts = get_posts( $options ); - if ( $posts && is_array( $posts ) ) return array_pop( $posts ); - else return false; + $options = array( + 'post_type' => 'sp_event', + 'posts_per_page' => 1, + 'order' => 'ASC', + 'post_status' => 'future', + ); + $options = array_merge( $options, $args ); + $posts = get_posts( $options ); + if ( $posts && is_array( $posts ) ) return array_pop( $posts ); + else return false; } } diff --git a/templates/countdown.php b/templates/countdown.php index 694e8164..59af4225 100644 --- a/templates/countdown.php +++ b/templates/countdown.php @@ -25,7 +25,7 @@ if ( isset( $id ) ): else: $args = array(); if ( isset( $team ) ) - $args = array( array( 'key' => 'sp_team', 'value' => $team ) ); + $args = array( 'meta_query' => array( array( 'key' => 'sp_team', 'value' => $team ) ) ); $post = sp_get_next_event( $args ); endif;