Make possible event filtering by Team **AND** Match Day
This commit is contained in:
@@ -306,15 +306,20 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
global $typenow, $wp_query;
|
global $typenow, $wp_query;
|
||||||
|
|
||||||
if ( $typenow == 'sp_event' ) {
|
if ( $typenow == 'sp_event' ) {
|
||||||
|
$query->query_vars['meta_query'] = array( 'relation' => 'AND' );
|
||||||
|
|
||||||
if ( ! empty( $_GET['team'] ) ) {
|
if ( ! empty( $_GET['team'] ) ) {
|
||||||
$query->query_vars['meta_value'] = $_GET['team'];
|
$query->query_vars['meta_query'][] = array(
|
||||||
$query->query_vars['meta_key'] = 'sp_team';
|
'key' => 'sp_team',
|
||||||
|
'value' => $_GET['team'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_GET['match_day'] ) ) {
|
if ( ! empty( $_GET['match_day'] ) ) {
|
||||||
$query->query_vars['meta_value'] = $_GET['match_day'];
|
$query->query_vars['meta_query'][] = array(
|
||||||
$query->query_vars['meta_key'] = 'sp_day';
|
'key' => 'sp_day',
|
||||||
|
'value' => $_GET['match_day'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user