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 $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;
|
||||||
|
|
@ -222,7 +219,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,
|
||||||
|
|
@ -230,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">
|
||||||
|
|
@ -282,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',
|
||||||
|
|
@ -291,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