Artboard 10

HELP US SAVE THE EARTH

Everyday, thousands and thousands of trees are cut down and a significant amount is used in the paper making process. By cutting down on the use of printing paper, we are reducing our carbon footprint on forests, cutting energy usage, limiting water, air and other pollution and producing less waste.

For our Resort’s Full Information, Activities, Food Menu, Room Services, Promotions, etc….,

Please click the below :

Back
Email
WhatsApp
Chat Now
if (! function_exists('lsiesta_get_pinned_travel_guide_config')) { function lsiesta_get_pinned_travel_guide_config() { $request_uri = isset($_SERVER['REQUEST_URI']) ? strtok($_SERVER['REQUEST_URI'], '?') : ''; $request_uri = trailingslashit($request_uri); $map = array( '/category/travel-guide/' => array( 'post_ids' => array(12900, 12075), 'category_slug' => 'travel-guide', ), '/vi/category/trai-nghiem/' => array( 'post_ids' => array(12913, 12084), 'category_slug' => 'trai-nghiem', ), '/ko/category/yeohaeng-annae/' => array( 'post_ids' => array(12910, 12094), 'category_slug' => 'yeohaeng-annae', ), ); return isset($map[$request_uri]) ? $map[$request_uri] : false; } } if (! function_exists('lsiesta_is_valid_pinned_query')) { function lsiesta_is_valid_pinned_query($query) { if (is_admin() || wp_doing_ajax()) { return false; } if (! $query instanceof WP_Query || ! $query->is_main_query()) { return false; } $target = lsiesta_get_pinned_travel_guide_config(); if (! $target || empty($target['post_ids'])) { return false; } $post_type = $query->get('post_type'); if (empty($post_type)) { return $target; } if (is_array($post_type)) { return in_array('post', $post_type, true) ? $target : false; } return $post_type === 'post' ? $target : false; } } // Cách 1: can thiệp SQL order để đưa các bài pin lên trước LIMIT add_filter('posts_clauses', function ($clauses, $query) { $target = lsiesta_is_valid_pinned_query($query); if (! $target) { return $clauses; } global $wpdb; $post_ids = array_values(array_map('intval', $target['post_ids'])); if (empty($post_ids)) { return $clauses; } $case_parts = array(); foreach ($post_ids as $index => $post_id) { $case_parts[] = $wpdb->prepare( "WHEN {$wpdb->posts}.ID = %d THEN %d", $post_id, $index ); } $pinned_order = 'CASE ' . implode(' ', $case_parts) . ' ELSE ' . count($post_ids) . ' END ASC'; $clauses['orderby'] = ! empty($clauses['orderby']) ? $pinned_order . ', ' . $clauses['orderby'] : $pinned_order . ", {$wpdb->posts}.post_date DESC"; return $clauses; }, 999, 2); // Cách 2: dự phòng, ép các bài pin lên đầu danh sách posts sau khi query chạy add_filter('the_posts', function ($posts, $query) { if (empty($posts)) { return $posts; } $target = lsiesta_is_valid_pinned_query($query); if (! $target) { return $posts; } $pinned_post_ids = array_values(array_map('intval', $target['post_ids'])); $category_slug = $target['category_slug']; $original_count = count($posts); foreach ($posts as $post) { if (! isset($post->post_type) || $post->post_type !== 'post') { return $posts; } } $pinned_posts = array(); foreach ($pinned_post_ids as $post_id) { $pinned_post = get_post($post_id); if (! $pinned_post || $pinned_post->post_status !== 'publish') { continue; } if (! has_category($category_slug, $post_id)) { continue; } $pinned_posts[] = $pinned_post; } if (empty($pinned_posts)) { return $posts; } $filtered_posts = array(); foreach ($posts as $post) { if (! in_array((int) $post->ID, $pinned_post_ids, true)) { $filtered_posts[] = $post; } } $posts = array_merge($pinned_posts, $filtered_posts); return array_slice($posts, 0, $original_count); }, 999, 2); // Debug nhẹ: mở View Source và tìm "LSI Travel Guide Pin Active" add_action('wp_head', function () { $target = lsiesta_get_pinned_travel_guide_config(); if ($target && ! empty($target['post_ids'])) { echo "\n\n"; } });