prepare_date($start_date, odp_get_date_format(), 'Y-m-d'),
'end_date' => prepare_date($end_date, odp_get_date_format(), 'Y-m-d'),
'guests' => $guests,
'sort' => "price.{$sort}",
'limit' => $limit,
'offset' => $limit * ($current_page - 1)
];
if (!empty($property_code)) {
$args['property_code'] = $property_code;
}
$result = odp_api_connect(ODP_API_URL, 'get', $args);
$pages = !empty($result['content']->total) && empty($property_code) ? ceil((int)sanitize_text_field($result['content']->total) / $limit) : 1;
if (!$result['state']) return '';
$items = !empty($result['content']->data) ? $result['content']->data : false;
global $hotel_points;
if (empty($property_code) && !empty($items)) {
foreach ($items as $hotel) {
if (!empty($hotel->latitude) && !empty($hotel->longitude)) {
$hotel_points[] = (object)[
'lat' => sanitize_text_field($hotel->latitude),
'lng' => sanitize_text_field($hotel->longitude)
];
}
}
}
?>
>