Compare commits

..

No commits in common. "3334906e1b682ec56c0894e509095a76b33ed0c7" and "295684c65491d374b44e3e4fff5e1d99bb42e2f8" have entirely different histories.

View File

@ -148,6 +148,9 @@ function metiers_patrimoine_filter_posts_declare_dropdowns()
{ {
global $typenow; global $typenow;
global $wp_meta_boxes; global $wp_meta_boxes;
// global $pagenow;
// write_log($wp_meta_boxes);
$post_type = (isset($_GET['post_type'])) ? $_GET['post_type'] : 'post'; $post_type = (isset($_GET['post_type'])) ? $_GET['post_type'] : 'post';
if ($post_type !== 'artisans') return; if ($post_type !== 'artisans') return;
@ -219,7 +222,7 @@ function metiers_patrimoine_filter_posts_declare_dropdowns()
<?php <?php
$is_current = isset($_GET['conseiller']) ? $_GET['conseiller'] : ''; $is_current = isset($_GET['conseiller']) ? $_GET['conseiller'] : '';
foreach ($conseillers as $index => $conseiller) { foreach ($conseillers as $index => $conseiller) {
if ($conseiller->ID == 1 || $conseiller->ID == 9) continue; // Escaping DeliAdmin and Conseiller accounts
printf( printf(
'<option value="%s"%s>%s</option>', '<option value="%s"%s>%s</option>',
$conseiller->ID, $conseiller->ID,
@ -227,11 +230,6 @@ 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">
@ -284,24 +282,13 @@ function filter_posts_by_acf_conseiller($query)
// FILTRE CONSEILLER // FILTRE CONSEILLER
if (!empty($_GET['conseiller'])) { if (!empty($_GET['conseiller'])) {
$query->set('meta_query', [
if ($_GET['conseiller'] == 'non_attribue') { [
$query->set('meta_query', [ 'key' => 'conseiller',
[ 'value' => sanitize_text_field($_GET['conseiller']),
'key' => 'conseiller', 'compare' => '='
'value' => '', ]
'compare' => '=' ]);
]
]);
} else {
$query->set('meta_query', [
[
'key' => 'conseiller',
'value' => sanitize_text_field($_GET['conseiller']),
'compare' => '='
]
]);
}
} }
} }