Add more parameters to next event function

This commit is contained in:
Brian Miyaji
2016-04-09 01:03:50 +10:00
parent aa8a42b168
commit fa7acb70c3
2 changed files with 11 additions and 11 deletions

View File

@@ -1271,16 +1271,16 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) {
if ( !function_exists( 'sp_get_next_event' ) ) { if ( !function_exists( 'sp_get_next_event' ) ) {
function sp_get_next_event( $args = array() ) { function sp_get_next_event( $args = array() ) {
$options = array( $options = array(
'post_type' => 'sp_event', 'post_type' => 'sp_event',
'posts_per_page' => 1, 'posts_per_page' => 1,
'order' => 'ASC', 'order' => 'ASC',
'post_status' => 'future', 'post_status' => 'future',
'meta_query' => $args, );
); $options = array_merge( $options, $args );
$posts = get_posts( $options ); $posts = get_posts( $options );
if ( $posts && is_array( $posts ) ) return array_pop( $posts ); if ( $posts && is_array( $posts ) ) return array_pop( $posts );
else return false; else return false;
} }
} }

View File

@@ -25,7 +25,7 @@ if ( isset( $id ) ):
else: else:
$args = array(); $args = array();
if ( isset( $team ) ) 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 ); $post = sp_get_next_event( $args );
endif; endif;