ccreation of filter country sorted and unique

This commit is contained in:
lenovo
2022-11-09 22:09:23 +01:00
parent 7af3572eaa
commit 4e7fa55234
2 changed files with 23 additions and 20 deletions

View File

@@ -99,20 +99,20 @@ function mp_get_published_posts() {
// FOR TESTS
// script to publish or unpublish posts
//
$post_args = array(
'numberposts' => -1,
'post_status' => 'draft',
//'post_status' => 'publish',
'post_type' => 'post',
);
$post_list = get_posts($post_args);
foreach ($post_list as $post) {
wp_update_post(array(
'ID' => $post->ID,
//'post_status' => 'draft',
'post_status' => 'publish',
));
};
// $post_args = array(
// 'numberposts' => -1,
// 'post_status' => 'draft',
// //'post_status' => 'publish',
// 'post_type' => 'post',
// );
// $post_list = get_posts($post_args);
// foreach ($post_list as $post) {
// wp_update_post(array(
// 'ID' => $post->ID,
// //'post_status' => 'draft',
// 'post_status' => 'publish',
// ));
// };
$get_posts_args = array(
'numberposts' => -1,

View File

@@ -8,18 +8,21 @@ function mp_add_filters(&$filter, $value) {
if (strlen($value) == 0)
return;
$value = trim($value, " ");
//mp_filter_insert_sort($filter, $value);
array_push($filter, $value);
$filter = array_unique($filter);
sort($filter);
}
function mp_get_filters($locations, $filters_fields) {
function mp_get_filters($locations) {
$filters = (object)[];
$filters->pays = [];
$filters->ville = [];
$filters->categorie = [];
$filters->country = [];
$filters->city = [];
$filters->category = [];
foreach ($locations as $loc) {
$location = $loc->events[0]->location;
mp_add_filters($filters->$field, $event->$field);
$country = $loc->events[0]->location->country;
mp_add_filters($filters->country, $country);
}
mp_console_log("filters:");