Compare commits
3 Commits
295684c654
...
3334906e1b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3334906e1b | ||
|
|
cf8dfc91b9 | ||
|
|
cef233ae26 |
|
|
@ -148,9 +148,6 @@ function metiers_patrimoine_filter_posts_declare_dropdowns()
|
|||
{
|
||||
global $typenow;
|
||||
global $wp_meta_boxes;
|
||||
// global $pagenow;
|
||||
|
||||
// write_log($wp_meta_boxes);
|
||||
|
||||
$post_type = (isset($_GET['post_type'])) ? $_GET['post_type'] : 'post';
|
||||
if ($post_type !== 'artisans') return;
|
||||
|
|
@ -222,7 +219,7 @@ function metiers_patrimoine_filter_posts_declare_dropdowns()
|
|||
<?php
|
||||
$is_current = isset($_GET['conseiller']) ? $_GET['conseiller'] : '';
|
||||
foreach ($conseillers as $index => $conseiller) {
|
||||
|
||||
if ($conseiller->ID == 1 || $conseiller->ID == 9) continue; // Escaping DeliAdmin and Conseiller accounts
|
||||
printf(
|
||||
'<option value="%s"%s>%s</option>',
|
||||
$conseiller->ID,
|
||||
|
|
@ -230,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">
|
||||
|
|
@ -282,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