function st_vc_slide_location($attr, $content = false) { $data = shortcode_atts(array('st_type' => '', 'is_featured' => 'no', 'st_number' => 4, 'st_list_location' => 0, 'st_weather' => 'no', 'st_style' => 'style_1', 'st_height' => 'full', 'effect' => 'fade'), $attr, 'st_slide_location'); extract($data); $query = array('post_type' => 'location'); if ($is_featured == 'yes') { $query['posts_per_page'] = $st_number; $query['orderby'] = 'meta_value_num'; $query['meta_query'] = array(array('key' => 'is_featured', 'value' => 'on', 'compare' => '=')); } else { $ids = explode(',', $st_list_location); $query['post__in'] = $ids; } query_posts($query); $txt = ''; while (have_posts()) { the_post(); if ($st_style == 'style_1') { $txt .= st()->load_template('vc-elements/st-slide-location/loop-style', '1', $data); } if ($st_style == 'style_2') { $txt .= st()->load_template('vc-elements/st-slide-location/loop-style', '2', $data); } } wp_reset_query(); if ($st_height == 'full') { $class = 'top-area show-onload'; } else { $class = 'special-area'; } if ($st_style == 'style_1') { $r = '<div class="' . $class . '"> <div class="owl-carousel owl-slider owl-carousel-area" id="owl-carousel-slider" data-effect="' . $effect . '"> ' . $txt . ' </div> </div>'; } if ($st_style == 'style_2') { $r = '<div class="' . $class . '"> <div class="bg-holder full"> <div class="bg-front bg-front-mob-rel"> <div class="container"> ' . st()->load_template('vc-elements/st-search/search', 'form', array('st_style_search' => 'style_2', 'st_box_shadow' => 'no', 'class' => 'search-tabs-abs mt50', 'title' => STLanguage::st_get_language('find_your_perfect_trip'))) . ' </div> </div> <div class="owl-carousel owl-slider owl-carousel-area visible-lg" id="owl-carousel-slider" data-effect="' . $effect . '"> ' . $txt . ' </div> </div> </div>'; } if (empty($txt)) { $r = ""; } return $r; }
} else { $link = home_url(esc_url('?s=&post_type=st_activity&location_id=' . get_the_ID())); } if ($offer < 2) { $offer = $offer . " " . __("Activity this Week", ST_TEXTDOMAIN); } else { $offer = $offer . " " . __("Activities this Week", ST_TEXTDOMAIN); } echo '<li><a href="' . $link . '"><i class="fa fa-bolt"></i> ' . $offer . '</a></li>'; } } ?> </ul> <?php $page_search = st_get_page_search_result($st_type); if (!empty($page_search)) { $link = add_query_arg(array('location_id' => get_the_ID()), get_the_permalink($page_search)); } else { $link = home_url(esc_url('?s=&post_type=' . $st_type . '&location_id=' . get_the_ID())); } ?> <a class="btn btn-white btn-ghost mt10" href="<?php echo esc_url($link); ?> "> <i class="fa fa-angle-right"></i> <?php echo STLanguage::st_get_language('explore'); ?> </a> </div>
function st_get_language($key) { if (class_exists('STLanguage')) { return STLanguage::st_get_language($key); } else { global $st_language; if (!empty($st_language[$key])) { return $st_language[$key]; } else { return $key; } } }
function st_vc_slide_location($attr, $content = false) { $data = shortcode_atts(array('st_type' => '', 'is_featured' => 'no', 'st_number' => 4, 'st_list_location' => 0, 'st_weather' => 'no', 'st_style' => 'style_1', 'st_height' => 'full', 'effect' => 'fade', 'link_to' => 'page_search', 'st_location_type' => ''), $attr, 'st_slide_location'); extract($data); $query = array('post_type' => 'location', 'posts_per_page' => -1); if ($is_featured == 'yes') { $query['posts_per_page'] = $st_number; $query['orderby'] = 'meta_value_num'; $query['meta_query'] = array(array('key' => 'is_featured', 'value' => 'on', 'compare' => '=')); } else { $ids = explode(',', $st_list_location); if (is_array($ids)) { $query['post__in'] = $ids; } } if ($st_location_type) { $tax_query = array(); $st_location_type = explode(',', $st_location_type); $tmp = array(); if (!empty($st_location_type) and is_array($st_location_type)) { foreach ($st_location_type as $key => $value) { $value = explode('/', $value); $tmp[] = $value; } } $tmp_term = array(); $tmp_tax = array(); if (!empty($tmp) and is_array($tmp)) { foreach ($tmp as $key => $value) { if ($key == 0 or !in_array($value[0], $tmp_tax)) { $tmp_tax[] = $value[0]; $tmp_term[$value[0]] = array($value[1]); } else { if (in_array($value[0], $tmp_tax)) { $type = $value[0]; $tmp_term[$type][] = $value[1]; } } } } if (!empty($tmp_term) and is_array($tmp_term)) { foreach ($tmp_term as $key => $value) { $query['tax_query'][] = array('taxonomy' => $key, 'field' => 'id', 'terms' => $value, 'operator' => "IN"); } $query['tax_query']['relation'] = "AND"; } } query_posts($query); $txt = ''; while (have_posts()) { the_post(); if ($st_style == 'style_1') { $txt .= st()->load_template('vc-elements/st-slide-location/loop-style', '1', $data); } if ($st_style == 'style_2') { $txt .= st()->load_template('vc-elements/st-slide-location/loop-style', '2', $data); } } wp_reset_query(); if ($st_height == 'full') { $class = 'top-area show-onload'; } else { $class = 'special-area'; } if ($st_style == 'style_1') { $r = '<div class="' . $class . '"> <div class="owl-carousel owl-slider owl-carousel-area" id="owl-carousel-slider" data-effect="' . $effect . '"> ' . $txt . ' </div> </div>'; } $bgr = ""; if (!empty($ids[0])) { $bgr_url = wp_get_attachment_image_src(get_post_thumbnail_id($ids[0]), 'full'); $bgr_url = $bgr_url[0]; $bgr = " style='background-image: url(" . $bgr_url . ")'"; } if ($st_style == 'style_2') { $r = '<div class="' . $class . '"> <div class="bg-holder full st-slider-location"' . $bgr . ' > <div class="bg-front bg-front-mob-rel"> <div class="container"> ' . st()->load_template('vc-elements/st-search/search', 'form', array('st_style_search' => 'style_2', 'st_box_shadow' => 'no', 'class' => 'search-tabs-abs mt50', 'title' => STLanguage::st_get_language('find_your_perfect_trip'))) . ' </div> </div> <div class="owl-carousel owl-slider owl-carousel-area visible-lg" id="owl-carousel-slider" data-effect="' . $effect . '"> ' . $txt . ' </div> </div> </div>'; } if (empty($txt)) { $r = ""; } return $r; }
while ($query->have_posts()) { $query->the_post(); $info_room = $info_room[0]; $price = STRental::get_price($info_room->ID); $price = TravelHelper::format_money($price); $date = date('l d M', strtotime(get_post_meta($info_room->ID, 'sale_price_from', true))) . " - " . date('l d M', strtotime(get_post_meta($info_room->ID, 'sale_price_to', true))); $txt = '<div class="text-center text-white"> <h2 class="text-uc mb20">' . STLanguage::st_get_language('last_minute_deal') . '</h2>'; $view_star_review = st()->get_option('view_star_review', 'review'); if ($view_star_review == 'review') { $txt .= ' <ul class="icon-list list-inline-block mb0 last-minute-rating"> ' . TravelHelper::rate_to_string(STReview::get_avg_rate()) . ' </ul>'; } elseif ($view_star_review == 'star') { $txt .= '<ul class="icon-list list-inline-block mb0 last-minute-rating">'; $star = STHotel::getStar(); $txt .= TravelHelper::rate_to_string($star); $txt .= '</ul>'; } $txt .= '<h5 class="last-minute-title">' . get_the_title() . ' - ' . $info_room->post_title . ' </h5> <p class="last-minute-date">' . $date . '</p> <p class="mb20"> <b>' . $price . '</b> / ' . STLanguage::st_get_language('night') . ' </p> <a href="' . get_the_permalink() . '" class="btn btn-lg btn-white btn-ghost"> ' . STLanguage::st_get_language('book_now') . '<i class="fa fa-angle-right"></i> </a> </div>'; echo balanceTags($txt); }
</div> <?php } ?> <h1 class="owl-cap-title fittext"><?php the_title(); ?> </h1> <div class="owl-cap-price <?php echo esc_html($st_type); ?> "> <?php $min_price = get_post_meta(get_the_ID(), 'min_price_' . $st_type, true); if (!empty($min_price)) { echo '<small>' . STLanguage::st_get_language('from') . '</small><h5>' . TravelHelper::format_money($min_price) . '</h5>'; } ?> </div> <?php $page_search = st_get_page_search_result($st_type); if (!empty($page_search)) { $link = add_query_arg(array('location_id' => get_the_ID()), get_the_permalink($page_search)); } else { $link = home_url(esc_url('?s=&post_type=' . $st_type . '&location_id=' . get_the_ID())); } ?> <a class="btn btn-white btn-ghost" href="<?php echo esc_url($link); ?> ">
$min_price = get_post_meta(get_the_ID(), 'min_price_st_cars', true); $min_price = TravelHelper::format_money($min_price); $offer = get_post_meta(get_the_ID(), 'offer_st_cars', true); if (!empty($min_price) and !empty($offer)) { $page_search = st_get_page_search_result('st_cars'); if (!empty($page_search)) { $link = add_query_arg(array('location_id' => get_the_ID()), get_the_permalink($page_search)); } else { $link = home_url(esc_url('?s=&post_type=st_cars&location_id=' . get_the_ID())); } if ($offer < 2) { $offer = $offer . " " . __("Car from", ST_TEXTDOMAIN); } else { $offer = $offer . " " . __("Cars from", ST_TEXTDOMAIN); } echo '<li><a href="' . $link . '"><i class="fa fa-car"></i> ' . $offer . ' ' . $min_price . '/' . STLanguage::st_get_language('day') . '</a></li>'; } $min_price = get_post_meta(get_the_ID(), 'min_price_st_tours', true); $min_price = TravelHelper::format_money($min_price); $offer = get_post_meta(get_the_ID(), 'offer_st_tours', true); if (!empty($min_price) and !empty($offer)) { $page_search = st_get_page_search_result('st_tours'); if (!empty($page_search)) { $link = add_query_arg(array('location_id' => get_the_ID()), get_the_permalink($page_search)); } else { $link = home_url(esc_url('?s=&post_type=st_tours&location_id=' . get_the_ID())); } if ($offer < 2) { $offer = $offer . " " . __("Tour from", ST_TEXTDOMAIN); } else { $offer = $offer . " " . __("Tours from", ST_TEXTDOMAIN);