load_helper('listing'); $Winter_MVC_WDK->model('location_m'); $location = $Winter_MVC_WDK->location_m->get($custom_field_value, TRUE); /* if root search childs */ if(empty(wmvc_show_data('parent_id', $location, false, TRUE, TRUE))) { $filter_ids = wdk_location_get_all_childs($custom_field_value); if(!empty($filter_ids)) { $filter_ids[] = $custom_field_value; if(in_array($field_value, $filter_ids) === FALSE) { $field_value = $custom_field_value; } } } } if(isset($_GET[$field_key])) { $field_value = ($_GET[$field_key]); } else { if(function_exists('run_wdk_geo') && (get_option('wdk_geo_autodetect_by_ip_enable') && !get_option('wdk_geo_autodetect_by_google_js_enable'))) { $field_value = wdk_geo_get_location_id(); } } wdk_search_fields_toggle(); ?> load_helper('listing'); $Winter_MVC_WDK->model('location_m'); $locations = array(); if(!empty($field_value)) { $locations[] = $field_value; $location = $Winter_MVC_WDK->location_m->get($field_value, TRUE); while(!empty($location->parent_id)) { $location = $Winter_MVC_WDK->location_m->get($location->parent_id, TRUE); $locations[] = $location->idlocation; } krsort($locations); } else { $locations[] = 0; } wp_enqueue_style('wdk-treefield-dropdown'); wp_enqueue_script('wdk-treefield-dropdown'); wp_enqueue_style( 'dashicons' ); $level_max = $Winter_MVC_WDK->location_m->get_max_level(); $placeholder = [ 0 => esc_html__('Select Country','wpdirectorykit'), 1 => esc_html__('Select City','wpdirectorykit'), 2 => esc_html__('Select Neighborhood','wpdirectorykit'), 3 => esc_html__('Select Sub Area','wpdirectorykit'), 4 => esc_html__('Select Sub Area','wpdirectorykit'), 5 => esc_html__('Select Sub Area','wpdirectorykit'), ]; ?> location_m->get($location, TRUE); $list = $Winter_MVC_WDK->location_m->get_by(array('parent_id = '.$current->parent_id => NULL)); if(isset($placeholder[$level])) { $values_list = array(''=> $placeholder[$level]); } else { $values_list = array(''=> esc_html__('Select Sub Categories','wpdirectorykit')); } foreach ($list as $list_value) { $values_list[$list_value->idlocation] = $list_value->location_title; } ?>