FEATURE Handling Filter by unattributed conseillers
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cf8dfc91b9
commit
3334906e1b
|
|
@ -227,6 +227,11 @@ function metiers_patrimoine_filter_posts_declare_dropdowns()
|
|||
$conseiller->display_name
|
||||
);
|
||||
}
|
||||
printf(
|
||||
'<option value="non_attribue"%s>%s</option>',
|
||||
$is_current == 'non_attribue' ? ' selected="selected"' : '',
|
||||
'— Non attribué —'
|
||||
);
|
||||
?>
|
||||
</select>
|
||||
<select name="mdpstatus">
|
||||
|
|
@ -279,13 +284,24 @@ function filter_posts_by_acf_conseiller($query)
|
|||
|
||||
// FILTRE CONSEILLER
|
||||
if (!empty($_GET['conseiller'])) {
|
||||
$query->set('meta_query', [
|
||||
[
|
||||
'key' => 'conseiller',
|
||||
'value' => sanitize_text_field($_GET['conseiller']),
|
||||
'compare' => '='
|
||||
]
|
||||
]);
|
||||
|
||||
if ($_GET['conseiller'] == 'non_attribue') {
|
||||
$query->set('meta_query', [
|
||||
[
|
||||
'key' => 'conseiller',
|
||||
'value' => '',
|
||||
'compare' => '='
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
$query->set('meta_query', [
|
||||
[
|
||||
'key' => 'conseiller',
|
||||
'value' => sanitize_text_field($_GET['conseiller']),
|
||||
'compare' => '='
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user