Enable events filtering in calendars based on Players participated (either team vs team or player vs player)
This commit is contained in:
@@ -334,6 +334,7 @@ class SP_Calendar extends SP_Secondary_Post {
|
||||
$seasons = get_the_terms( $this->ID, 'sp_season' );
|
||||
$venues = get_the_terms( $this->ID, 'sp_venue' );
|
||||
$teams = array_filter( get_post_meta( $this->ID, 'sp_team', false ) );
|
||||
$players = array_filter( get_post_meta( $this->ID, 'sp_player', false ) );
|
||||
$table = get_post_meta( $this->ID, 'sp_table', true );
|
||||
|
||||
if ( ! isset( $league_ids ) ) $league_ids = array();
|
||||
@@ -395,6 +396,16 @@ class SP_Calendar extends SP_Secondary_Post {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $players ) ) {
|
||||
$args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'sp_player',
|
||||
'value' => $players,
|
||||
'compare' => 'IN',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->event) {
|
||||
$args['p'] = $this->event;
|
||||
|
||||
Reference in New Issue
Block a user