Add more parameters to next event function
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user