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
|
$conseiller->display_name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
printf(
|
||||||
|
'<option value="non_attribue"%s>%s</option>',
|
||||||
|
$is_current == 'non_attribue' ? ' selected="selected"' : '',
|
||||||
|
'— Non attribué —'
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<select name="mdpstatus">
|
<select name="mdpstatus">
|
||||||
|
|
@ -279,6 +284,16 @@ function filter_posts_by_acf_conseiller($query)
|
||||||
|
|
||||||
// FILTRE CONSEILLER
|
// FILTRE CONSEILLER
|
||||||
if (!empty($_GET['conseiller'])) {
|
if (!empty($_GET['conseiller'])) {
|
||||||
|
|
||||||
|
if ($_GET['conseiller'] == 'non_attribue') {
|
||||||
|
$query->set('meta_query', [
|
||||||
|
[
|
||||||
|
'key' => 'conseiller',
|
||||||
|
'value' => '',
|
||||||
|
'compare' => '='
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
$query->set('meta_query', [
|
$query->set('meta_query', [
|
||||||
[
|
[
|
||||||
'key' => 'conseiller',
|
'key' => 'conseiller',
|
||||||
|
|
@ -288,6 +303,7 @@ function filter_posts_by_acf_conseiller($query)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
add_action('pre_get_posts', 'filter_posts_by_acf_conseiller');
|
add_action('pre_get_posts', 'filter_posts_by_acf_conseiller');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user