function st_vc_list_activity($attr, $content = false) { $data_vc = STActivity::get_taxonomy_and_id_term_activity(); $param = array('st_ids' => "", 'st_number' => 4, 'st_order' => '', 'st_orderby' => '', 'st_of_row' => 4, 'only_featured_location' => 'no', 'st_location' => '', 'sort_taxonomy' => ''); $param = array_merge($param, $data_vc['list_id_vc']); $data = shortcode_atts($param, $attr, 'st_list_activity'); extract($data); $page = STInput::request('paged'); if (!$page) { $page = get_query_var('paged'); } $query = array('post_type' => 'st_activity', 'posts_per_page' => $st_number, 'paged' => $page, 'order' => $st_order, 'orderby' => $st_orderby); if (!empty($st_ids)) { $query['post__in'] = explode(',', $st_ids); $query['orderby'] = 'post__in'; } if ($st_orderby == 'sale') { $query['meta_key'] = 'price'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'rate') { $query['meta_key'] = 'rate_review'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'discount') { $query['meta_key'] = 'discount'; $query['orderby'] = 'meta_value'; } $_SESSION['el_only_featured_location'] = $only_featured_location; $_SESSION['el_st_location'] = $st_location; $_SESSION['el_featured'] = array(); if ($only_featured_location == 'yes') { $STLocation = new STLocation(); $featured = $STLocation->get_featured_ids(); $_SESSION['featured'] = $featured; } $st_list_activity = new st_list_activity(); if ($only_featured_location == 'yes' || !empty($st_location)) { add_filter('posts_where', array($st_list_activity, '_get_query_where')); add_filter('posts_join', array($st_list_activity, '_get_query_join')); } if (!empty($sort_taxonomy)) { if (isset($attr["id_term_" . $sort_taxonomy])) { $id_term = $attr["id_term_" . $sort_taxonomy]; $query['tax_query'] = array(array('taxonomy' => $sort_taxonomy, 'field' => 'id', 'terms' => explode(',', $id_term))); } } query_posts($query); remove_filter('posts_where', array($st_list_activity, '_get_query_where')); remove_filter('posts_join', array($st_list_activity, '_get_query_join')); unset($_SESSION['el_only_featured_location']); unset($_SESSION['el_st_location']); unset($_SESSION['el_featured']); $r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-activity/loop', '', $data) . "</div>"; wp_reset_query(); return $r; }
public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); $args['after_title'] = apply_filters('after_title_widget_location', $args['after_title']); $args['before_title'] = apply_filters('before_title_widget_location', $args['before_title']); $args['before_widget'] = apply_filters('before_widget_location', $args['before_widget']); $args['after_widget'] = apply_filters('after_widget_location', $args['after_widget']); $post_type = $instance['post_type'] ? $instance['post_type'] : "st_cars"; echo balancetags($args['before_widget']); if (!empty($title)) { echo balancetags($args['before_title'] . $title . $args['after_title']); } $post_type = $instance['post_type'] ? $instance['post_type'] : "st_cars"; $array = STLocation::get_info_by_post_type(get_the_ID(), $post_type); $array['title'] = $instance['title'] ? $instance['title'] : ""; $array['post_type'] = $instance['post_type']; if (!isset($instance['use_feature']) || $instance['use_feature'] == "feature") { $post_id = STLocation::get_random_post_type(get_the_ID(), $instance['post_type']); $array['thumb'] = get_post_thumbnail_id($post_id); } else { $array['thumb'] = $instance['background'] ? $instance['background'] : ""; } echo st()->load_template('location/location-content-item', null, $array); echo balancetags($args['after_widget']); }
function st_location_list_activity_func($attr) { $data = shortcode_atts(array('st_location_style' => "", 'st_location_num' => "", 'st_location_orderby' => "", 'st_location_order' => ""), $attr, 'st_location_list_car'); extract($data); $return; $query = array('post_type' => 'st_activity', 'meta_key' => 'id_location', 'meta_value' => get_the_ID(), 'posts_per_page' => $st_location_num, 'order' => $st_location_order, 'orderby' => $st_location_orderby, 'post_status' => 'publish'); if (STInput::request('style')) { $st_location_style = STInput::request('style'); } if ($st_location_style == 'list') { $return .= "<ul class='booking-list loop-tours style_list loop-activity-location'>"; } else { $return .= '<div class="row row-wrap grid-activity-location">'; } query_posts($query); while (have_posts()) { the_post(); if ($st_location_style == 'list') { $return .= st()->load_template('activity/elements/loop/loop-1', null, array('is_location' => true)); } else { $return .= st()->load_template('activity/elements/loop/loop-2', null, array('is_location' => true)); } } wp_reset_query(); if ($st_location_style == 'list') { $return .= "</ul>"; } else { $return .= '</div>'; } $link = STLocation::get_total_text_footer('st_activity'); $return .= balancetags($link); return $return; }
static function get_min_max_price($post_type) { if (empty($post_type) || !TravelHelper::checkTableDuplicate($post_type)) { return array('price_min' => 0, 'price_max' => 500); } $meta_key = 'sale_price'; if ($post_type == 'st_hotel') { $meta_key = 'price_avg'; } $location_text = "id_location"; if ($post_type == 'st_rental') { $location_text = 'location_id'; } global $wpdb; $sql = "\r\n select \r\n min(CAST({$meta_key} as DECIMAL)) as min,\r\n max(CAST({$meta_key} as DECIMAL)) as max"; if ($post_type == 'st_tours' || $post_type == 'st_holidays' || $post_type == 'st_activity') { /*$sql = " select min(CAST(child_price as Decimal)) , min(CAST(adult_price as Decimal)), max(CAST(child_price as Decimal)) , max(CAST(adult_price as Decimal)) " ;*/ $sql = "\r\n select \r\n min(CAST(adult_price as Decimal)), \r\n max(CAST(adult_price as Decimal)) \r\n "; } $sql .= " from {$wpdb->prefix}{$post_type} "; $join = ""; $where = ""; $join .= " join {$wpdb->posts} on {$wpdb->posts}.ID = {$wpdb->prefix}{$post_type}.post_id "; $join = STLocation::edit_join_wpml($join, $post_type); $sql .= $join; $where = " where (1=1 ) "; $where .= "and \r\n (\r\n {$wpdb->posts}.post_status = 'publish'\r\n )\r\n "; $where = STLocation::edit_where_wpml($where); $sql .= $where; //echo $sql; $results = $wpdb->get_results($sql, OBJECT); $array_price = array(); if ($post_type == 'st_tours' || $post_type == 'st_holidays' || $post_type == 'st_activity') { foreach ($results[0] as $key => $value) { $array_price[] = $value; } $price_min = min($array_price); $price_max = max($array_price); } else { $price_min = $results[0]->min; $price_max = $results[0]->max; } if (!$price_max) { $price_max = 500; } // default 0 500 return array('price_min' => ceil($price_min), 'price_max' => ceil($price_max)); }
/** * @since 1.1.3 * text in footer location element * */ static function get_total_text_footer($post_type) { /* Example 10 cars in paris*/ $link = STLocation::get_link_search($post_type); $count_post_type = STLocation::get_count_post_type($post_type); if ($post_type == "st_cars") { $post_type_names = __(' cars ', ST_TEXTDOMAIN); $post_type_name = __(' car ', ST_TEXTDOMAIN); } if ($post_type == "st_hotel") { $post_type_names = __(' hotels ', ST_TEXTDOMAIN); $post_type_name = __(' hotel ', ST_TEXTDOMAIN); } if ($post_type == "st_rental") { $post_type_names = __(' rentals ', ST_TEXTDOMAIN); $post_type_name = __(' rental ', ST_TEXTDOMAIN); } if ($post_type == "st_tours") { $post_type_names = __(' tours ', ST_TEXTDOMAIN); $post_type_name = __(' tour ', ST_TEXTDOMAIN); } if ($post_type == "st_activity") { $post_type_names = __(' activities ', ST_TEXTDOMAIN); $post_type_name = __(' activity ', ST_TEXTDOMAIN); } $text; if ($count_post_type > 1) { $text .= esc_html($count_post_type) . $post_type_names; } else { $text .= esc_html($count_post_type) . $post_type_name; } $text .= __(" in ", ST_TEXTDOMAIN) . get_the_title() . " ."; $return .= "\r\n <div class='text-right'>\r\n <span>" . $text . "</span>\r\n <a href=" . esc_url($link) . ">" . __("View all", ST_TEXTDOMAIN) . "</a>\r\n </div>\r\n "; return $return; }
function st_location_map($attr) { $return = "<div style='position: relative' id='google-map-tab' data-lat= '" . get_post_meta(get_the_ID(), 'map_lat', true) . "' data-long = '" . get_post_meta(get_the_ID(), 'map_lng', true) . "' >"; $st_type; $number = get_post_meta(get_the_ID(), 'max_post_type_num', true); if (!$number) { $number = 36; } $zoom = get_post_meta(get_the_ID(), 'map_zoom', true); if (!$zoom) { $zoom = 15; } $map_height = get_post_meta(get_the_ID(), 'map_height', true); if (!$map_height) { $map_height = 500; } $map_location_style = get_post_meta(get_the_ID(), 'map_location_style', true); if (!$map_location_style) { $map_location_style = 'normal'; } $list_post_type = STLocation::get_post_type_list_active(); $shortcode_string = ""; if (is_array($list_post_type) and !empty($list_post_type)) { foreach ($list_post_type as $key => $value) { if (get_post_meta(get_the_ID(), 'tab_enable_' . $value, true) == 'on') { $flag = $value; } if ($key != 0) { $shortcode_string .= "," . $value; } else { $shortcode_string .= $value; } } } $show_data_list_map = apply_filters('show_data_list_map', 'no'); $return .= do_shortcode('[st_list_map st_type= "' . $shortcode_string . '" number="' . $number . '" zoom="' . $zoom . '" height="' . $map_height . '" style_map="' . $map_location_style . '" st_list_location="' . get_the_ID() . '" show_data_list_map = "' . $show_data_list_map . '" show_search_box = "no"]'); $return .= "</div>"; return $return; }
$count_activity = STLocation::get_info_by_post_type(get_the_ID(), 'st_activity'); $count_rental = STLocation::get_info_by_post_type(get_the_ID(), 'st_rental'); $array_s = array('st_cars' => array('count' => $count_car['offers'], "from" => $count_car['min_max_price']['price_min'], "item_has_min" => $count_car['min_max_price']['detail']['item_has_min_price']), 'st_tours' => array('count' => $count_tours['offers'], "from" => $count_tours['min_max_price']['price_min'], "item_has_min" => $count_tours['min_max_price']['detail']['item_has_min_price']), 'st_hotel' => array('count' => $count_hotel['offers'], "from" => $count_hotel['min_max_price']['price_min'], "item_has_min" => $count_hotel['min_max_price']['detail']['item_has_min_price']), 'st_activity' => array('count' => $count_activity['offers'], "from" => $count_activity['min_max_price']['price_min'], "item_has_min" => $count_activity['min_max_price']['detail']['item_has_min_price']), 'st_rental' => array('count' => $count_rental['offers'], "from" => $count_rental['min_max_price']['price_min'], "item_has_min" => $count_rental['min_max_price']['detail']['item_has_min_price'])); $custom = $st_location_header_rate_count_custom; $html = $st_location_header_rate_count_item_custom; $list_post_type = $st_location_header_rate_count_post_type; $list_post_type = explode(",", $list_post_type); ?> <ul class="icon-list text-white bgr-opacity" id='location_header_rate_count'> <?php if (is_array($array_s) and !empty($array_s)) { foreach ($array_s as $key => $value) { if (in_array($key, $list_post_type)) { ?> <li><a href='<?php echo STLocation::get_link_search($key); ?> '> <?php echo esc_attr($value['count']); ?> <?php echo esc_html($text); if ($key == "st_cars") { echo st_get_language('cars'); } if ($key == "st_tours") { echo st_get_language('tours'); } if ($key == "st_hotel") {
<?php $st_type; if (!$number) { $number = 36; } if (!$map_height) { $map_height = 500; } if (!isset($map_location_style)) { $map_location_style = 'normal'; } $zoom = get_post_meta(get_the_ID(), 'map_zoom_location', true); if (!$zoom) { $zoom = 15; } $list_post_type = STLocation::get_post_type_list_active(); $shortcode_string = ""; if (is_array($list_post_type) and !empty($list_post_type)) { foreach ($list_post_type as $key => $value) { if (get_post_meta(get_the_ID(), 'tab_enable_' . $value, true) == 'on') { $flag = $value; } if ($key != 0) { $shortcode_string .= "," . $value; } else { $shortcode_string .= $value; } } } $show_data_list_map = apply_filters('show_data_list_map', 'no'); echo do_shortcode('[st_list_map
$layout_id = st()->get_option('hotel_search_result_page', true); $image_attributes = wp_get_attachment_image_src($thumb, array(800, 600)); $link = esc_url(add_query_arg(array('location_name' => get_the_title(), 'location_id' => get_the_ID(), 'post_type' => $post_type, 's' => '', 'layout' => $post_type == "st_hotel" ? $layout_id : ''), home_url())); ?> <div class=""> <div class="thumb"> <a class="hover-img" href="<?php echo esc_url($link); ?> "> <?php if ($image_attributes) { ?> <?php echo STLocation::scrop_thumb($image_attributes[0]); ?> <?php } ?> <div class="hover-inner hover-inner-block hover-inner-bottom hover-inner-bg-black hover-hold"> <div class="text-small"> <h5><?php the_title(); ?> <?php echo esc_attr($post_type_name); ?> </h5> <p><?php
} return $where; } /** * from 1.1.8 */ static function edit_join_wpml($join, $post_type) { if (defined('ICL_LANGUAGE_CODE')) { global $wpdb; $join .= "\r\n join {$wpdb->prefix}icl_translations as t ON {$wpdb->posts}.ID = t.element_id\r\n AND t.element_type = 'post_{$post_type}'\r\n JOIN {$wpdb->prefix}icl_languages as l ON t.language_code = l. CODE\r\n AND l.active = 1 "; } return $join; } } $a = new STLocation(); $a->init(); } // for location single if (!class_exists('st_location')) { class st_location { static function _get_query_join($join) { $post_type = $_SESSION['el_post_type']; if (!TravelHelper::checkTableDuplicate($post_type)) { return $join; } global $wpdb; $table = $wpdb->prefix . $post_type; $join .= " INNER JOIN {$table} as tb ON {$wpdb->prefix}posts.ID = tb.post_id";
<ul class="nav nav-tabs "> <li class="active"> <a href="#tab_info" data-toggle="tab"> <i class="<?php echo get_post_meta(get_the_ID(), 'tab_icon_info_icon', true); ?> "></i> <?php echo esc_attr(get_post_meta(get_the_ID(), 'information_text_title', true)); ?> </a> </li> <?php $meta = get_post_meta(get_the_ID(), 'location_tab_item', true); if (!$meta) { $meta = STLocation::get_opt_list_std(); } if (!empty($meta) and is_array($meta)) { foreach ($meta as $key => $value) { $href = $value['tab_type'] . $key; $icon = $value['tab_icon_']; $name = $value['title']; if ($value['tab_type'] == 'st_map') { $href = "google-map-tab"; } ?> <li> <a href="#<?php echo esc_attr($href); ?> " data-toggle="tab">
function st_vc_list_hotel($attr, $content = false) { $data = shortcode_atts(array('st_ids' => "", 'st_number_ht' => 0, 'st_order' => '', 'st_orderby' => '', 'st_ht_of_row' => '', 'st_style_ht' => '', 'only_featured_location' => 'no', 'st_location' => ''), $attr, 'st_list_hotel'); extract($data); $query = array('post_type' => 'st_hotel', 'posts_per_page' => $st_number_ht, 'order' => $st_order, 'orderby' => $st_orderby); if (!empty($st_ids)) { $query['post__in'] = explode(',', $st_ids); } if ($st_style_ht == 'bg_last_minute_deal') { $query = array('post_type' => 'hotel_room', 'posts_per_page' => 1, 'meta_key' => 'sale_price_from', 'order' => 'desc', 'orderby' => 'meta_value', 'meta_query' => array('key' => 'is_sale_schedule', 'value' => 'on', 'compare' => "=")); $post = query_posts($query); $data['info_room'] = $post; wp_reset_query(); if (!empty($post)) { $id_hotel = get_post_meta($post[0]->ID, "room_parent", true); $query = array('post_type' => 'st_hotel', 'posts_per_page' => 1, 'post__in' => array($id_hotel)); } else { /*$query=array( 'post_type' => 'hotel_room', 'posts_per_page'=>1, 'meta_key'=>'discount_rate', 'order'=>'ASC', 'orderby'=>'meta_value', ); $post = query_posts($query); $data['info_room'] = $post; wp_reset_query(); if(!empty($post)) { $id_hotel = get_post_meta($post[0]->ID, "room_parent", true); $query = array( 'post_type' => 'st_hotel', 'posts_per_page' => 1, 'post__in' => array($id_hotel), ); }*/ } } if ($st_orderby == 'sale') { $query['meta_key'] = 'total_sale_number'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'rate') { $query['meta_key'] = 'rate_review'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'discount') { $query['meta_key'] = 'discount_rate'; $query['orderby'] = 'meta_value'; } if ($only_featured_location == 'yes') { $STLocation = new STLocation(); $featured = $STLocation->get_featured_ids(); $query['meta_query'][] = array('key' => 'id_location', 'value' => $featured, 'compare' => "IN"); } if (!empty($st_location)) { $query['meta_query'][] = array('key' => 'id_location', 'value' => $st_location, 'compare' => "IN"); } $query = new WP_Query($query); $data['query'] = $query; $r = st()->load_template('vc-elements/st-list-hotel/loop', $st_style_ht, $data); wp_reset_query(); return $r; }
function st_vc_list_hotel($attr, $content = false) { global $wp_query; $data = shortcode_atts(array('st_ids' => "", 'st_number_ht' => 4, 'st_order' => '', 'st_orderby' => '', 'st_ht_of_row' => 4, 'st_style_ht' => 'bg_last_minute_deal', 'only_featured_location' => 'no', 'st_location' => ''), $attr, 'st_list_hotel'); extract($data); $query = array('post_type' => 'st_hotel', 'posts_per_page' => $st_number_ht, 'order' => $st_order, 'orderby' => $st_orderby); if (!empty($st_ids)) { $query['post__in'] = explode(',', $st_ids); $query['orderby'] = 'post__in'; } if ($st_style_ht == 'bg_last_minute_deal') { $query = array('post_type' => 'hotel_room', 'posts_per_page' => 1, 'meta_key' => 'sale_price_from', 'order' => 'desc', 'orderby' => 'meta_value'); add_filter('posts_where', 'st_hotel_last_minute_deal_filter'); add_filter('posts_join', 'st_hotel_last_minute_deal_join'); $post = query_posts($query); remove_filter('posts_where', 'st_hotel_last_minute_deal_filter'); remove_filter('posts_join', 'st_hotel_last_minute_deal_join'); $data['info_room'] = $post; wp_reset_query(); if (!empty($post)) { $id_hotel = get_post_meta($post[0]->ID, "room_parent", true); $query = array('post_type' => 'st_hotel', 'posts_per_page' => 1, 'post__in' => array($id_hotel)); } else { $query = array('post_type' => 'hotel_room', 'posts_per_page' => 1, 'meta_key' => 'discount_rate', 'order' => 'ASC', 'orderby' => 'meta_value'); add_filter('posts_where', 'st_hotel_last_minute_deal_filter'); add_filter('posts_join', 'st_hotel_last_minute_deal_join'); $post = query_posts($query); remove_filter('posts_where', 'st_hotel_last_minute_deal_filter'); remove_filter('posts_join', 'st_hotel_last_minute_deal_join'); $data['info_room'] = $post; wp_reset_query(); if (!empty($post)) { $id_hotel = get_post_meta($post[0]->ID, "room_parent", true); $query = array('post_type' => 'st_hotel', 'posts_per_page' => 1, 'post__in' => array($id_hotel)); } } } if ($st_orderby == 'sale') { $query['meta_key'] = 'total_sale_number'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'rate') { $query['meta_key'] = 'rate_review'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'discount') { $query['meta_key'] = 'discount_rate'; $query['orderby'] = 'meta_value'; } $_SESSION['el_only_featured_location'] = $only_featured_location; $_SESSION['st_st_location'] = $st_location; $_SESSION['el_featured'] = array(); if ($only_featured_location == 'yes') { $STLocation = new STLocation(); $featured = $STLocation->get_featured_ids(); $_SESSION['el_featured'] = $featured; } $st_list_hotel = new st_list_hotel(); if ($only_featured_location == 'yes' || !empty($st_location)) { add_filter('posts_where', array($st_list_hotel, '_get_query_where')); add_filter('posts_join', array($st_list_hotel, '_get_query_join')); } $query = new WP_Query($query); remove_filter('posts_where', array($st_list_hotel, '_get_query_where')); remove_filter('posts_join', array($st_list_hotel, '_get_query_join')); unset($_SESSION['el_only_featured_location']); unset($_SESSION['st_st_location']); unset($_SESSION['el_featured']); $data['query'] = $query; $r = st()->load_template('vc-elements/st-list-hotel/loop', $st_style_ht, $data); wp_reset_query(); return $r; }
$list = TravelHelper::getLocationByParent($location); $result = STLocation::get_info_by_post_type(get_the_ID(), $value, $list); if (STLocation::round_count_reviews($result['offers'])) { echo "<br>"; echo STLocation::round_count_reviews($result['offers']) . " " . $result['post_type_name']; } $count_review += $result['reviews']; } } ?> <?php if (!empty($count_review_s) and $count_review_s == "on" and STLocation::round_count_reviews($count_review)) { ?> <br><?php echo __("Over", ST_TEXTDOMAIN); ?> <?php echo esc_attr(STLocation::round_count_reviews($count_review)); ?> <?php if ($count_review >= 2) { echo __("reviews", ST_TEXTDOMAIN); } else { echo __("review", ST_TEXTDOMAIN); } ?> <?php } ?> </p>
function st_vc_list_holiday($attr, $content = false) { $data_vc = STHoliday::get_taxonomy_and_id_term_holiday(); $param = array('st_ids' => '', 'st_number_holiday' => 4, 'st_order' => '', 'st_orderby' => '', 'st_holiday_of_row' => '', 'st_style' => 'style_1', 'only_featured_location' => 'no', 'st_location' => '', 'sort_taxonomy' => '', 'title' => '', 'font_size' => '3'); $param = array_merge($param, $data_vc['list_id_vc']); $data = shortcode_atts($param, $attr, 'st_list_holiday'); extract($data); $page = STInput::request('paged'); if (!$page) { $page = get_query_var('paged'); } $query = array('post_type' => 'st_holidays', 'posts_per_page' => $st_number_holiday, 'paged' => $page, 'order' => $st_order, 'orderby' => $st_orderby); if (!empty($st_ids)) { $query['post__in'] = explode(',', $st_ids); $query['orderby'] = 'post__in'; } if ($st_orderby == 'sale') { $query['meta_key'] = 'price'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'rate') { $query['meta_key'] = 'rate_review'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'discount') { $query['meta_key'] = 'discount'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'last_minute_deal') { $query['order'] = 'DESC'; $query['orderby'] = 'meta_value'; $query['meta_key'] = 'sale_price_from'; $query['meta_query'][] = array('key' => 'is_sale_schedule', 'value' => 'on', 'compare' => "="); } if (!empty($sort_taxonomy)) { if (isset($attr["id_term_" . $sort_taxonomy])) { $id_term = $attr["id_term_" . $sort_taxonomy]; $query['tax_query'] = array(array('taxonomy' => $sort_taxonomy, 'field' => 'id', 'terms' => explode(',', $id_term))); } } $_SESSION['el_only_featured_location'] = $only_featured_location; $_SESSION['el_st_location'] = $st_location; $_SESSION['el_featured'] = array(); if ($only_featured_location == 'yes') { $STLocation = new STLocation(); $featured = $STLocation->get_featured_ids(); $_SESSION['el_featured'] = $featured; } $st_list_holiday = new st_list_holiday(); if ($only_featured_location == 'yes' || !empty($st_location)) { add_filter('posts_where', array($st_list_holiday, '_get_query_where')); add_filter('posts_join', array($st_list_holiday, '_get_query_join')); } query_posts($query); remove_filter('posts_where', array($st_list_holiday, '_get_query_where')); remove_filter('posts_join', array($st_list_holiday, '_get_query_join')); unset($_SESSION['el_only_featured_location']); unset($_SESSION['el_st_location']); unset($_SESSION['el_featured']); if ($st_style == 'style_1') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop', '', $data) . "</div>"; } if ($st_style == 'style_2') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop2', '', $data) . "</div>"; } if ($st_style == 'style_3') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop3', '', $data) . "</div>"; } if ($st_style == 'style_4') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop4', '', $data) . "</div>"; } wp_reset_query(); if (!empty($title) and !empty($r)) { $r = '<h' . $font_size . '>' . $title . '</h' . $font_size . '>' . $r; } return $r; }
<?php if (function_exists('vc_map')) { $list_location = TravelerObject::get_list_location(); $list_location_data[__('-- Select --', ST_TEXTDOMAIN)] = ''; if (!empty($list_location)) { foreach ($list_location as $k => $v) { $list_location_data[$v['title']] = $v['id']; } } $st_location_type = array(); $list_terms = STLocation::get_location_terms(); if (!empty($list_terms) and is_array($list_terms)) { foreach ($list_terms as $key => $value) { $st_location_type[$value->name] = $value->taxonomy . "/" . $value->term_id; } } vc_map(array("name" => __("ST Slide Location", ST_TEXTDOMAIN), "base" => "st_slide_location", "content_element" => true, "icon" => "icon-st", "category" => "Shinetheme", "params" => array(array("type" => "dropdown", "holder" => "div", "heading" => __("Explore type", ST_TEXTDOMAIN), "param_name" => "st_type", "description" => "", 'value' => array(__('--Select--', ST_TEXTDOMAIN) => '', __('Hotel', ST_TEXTDOMAIN) => 'st_hotel', __('Car', ST_TEXTDOMAIN) => 'st_cars', __('Tour', ST_TEXTDOMAIN) => 'st_tours', __('Holiday', ST_TEXTDOMAIN) => 'st_holidays', __('Rental', ST_TEXTDOMAIN) => 'st_rental', __('Activities', ST_TEXTDOMAIN) => 'st_activity')), array("type" => "dropdown", "holder" => "div", "heading" => __("Show Only Featured Location", ST_TEXTDOMAIN), "param_name" => "is_featured", "description" => __("Show Only Featured Location", ST_TEXTDOMAIN), 'value' => array(__('--Select--', ST_TEXTDOMAIN) => '', __("No", ST_TEXTDOMAIN) => 'no', __("Yes", ST_TEXTDOMAIN) => 'yes')), array("type" => "checkbox", "holder" => "div", "heading" => __("Location type", ST_TEXTDOMAIN), "param_name" => "st_location_type", "description" => "", "value" => $st_location_type), array("type" => "textfield", "holder" => "div", "heading" => __("Number Location", ST_TEXTDOMAIN), "param_name" => "st_number", "description" => "", 'value' => 4, 'dependency' => array('element' => 'is_featured', 'value' => array('yes'))), array("type" => "st_post_type_location", "holder" => "div", "heading" => __("Select Location ", ST_TEXTDOMAIN), "param_name" => "st_list_location", "description" => "", 'dependency' => array('element' => 'is_featured', 'value' => array('no'))), array("type" => "dropdown", "holder" => "div", "heading" => __("Style show ", ST_TEXTDOMAIN), "param_name" => "st_style", "description" => "", 'value' => array(__('--Select--', ST_TEXTDOMAIN) => '', __('Text info center', ST_TEXTDOMAIN) => 'style_1', __('Show Search Box', ST_TEXTDOMAIN) => 'style_2')), array("type" => "dropdown", "holder" => "div", "heading" => __("Effect", ST_TEXTDOMAIN), "param_name" => "effect", "description" => "", 'value' => array(__('--Select--', ST_TEXTDOMAIN) => '', __('None', ST_TEXTDOMAIN) => 'false', __('Fade', ST_TEXTDOMAIN) => 'fade', __('Back Slide', ST_TEXTDOMAIN) => 'backSlide', __('Go Down', ST_TEXTDOMAIN) => 'goDown', __('Fade Up', ST_TEXTDOMAIN) => 'fadeUp')), array("type" => "dropdown", "holder" => "div", "heading" => __("Weather show ", ST_TEXTDOMAIN), "param_name" => "st_weather", "description" => "", 'value' => array(__('--Select--', ST_TEXTDOMAIN) => '', __('Yes', ST_TEXTDOMAIN) => 'yes', __('No', ST_TEXTDOMAIN) => 'no')), array("type" => "dropdown", "holder" => "div", "heading" => __("Height", ST_TEXTDOMAIN), 'dependency' => array('element' => 'st_style', 'value' => 'style_1'), "param_name" => "st_height", "description" => "", 'value' => array(__('--Select--', ST_TEXTDOMAIN) => '', __('Full height', ST_TEXTDOMAIN) => 'full', __('Half height', ST_TEXTDOMAIN) => 'half')), array("type" => "dropdown", "holder" => "div", "heading" => __("Link To", ST_TEXTDOMAIN), "param_name" => "link_to", "description" => __("Link To", ST_TEXTDOMAIN), 'value' => array(__("Page Search", ST_TEXTDOMAIN) => 'page_search', __("Single", ST_TEXTDOMAIN) => 'single'), 'edit_field_class' => 'vc_col-sm-12')))); } if (!function_exists('st_vc_slide_location')) { 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);
function st_vc_list_tour($attr, $content = false) { $data_vc = STTour::get_taxonomy_and_id_term_tour(); $param = array('st_ids' => '', 'st_number_tour' => 0, 'st_order' => '', 'st_orderby' => '', 'st_tour_of_row' => '', 'st_style' => '', 'only_featured_location' => '', 'st_location' => '', 'sort_taxonomy' => ''); $param = array_merge($param, $data_vc['list_id_vc']); $data = shortcode_atts($param, $attr, 'st_list_tour'); extract($data); $page = STInput::request('paged'); if (!$page) { $page = get_query_var('paged'); } $query = array('post_type' => 'st_tours', 'posts_per_page' => $st_number_tour, 'paged' => $page, 'order' => $st_order, 'orderby' => $st_orderby); if (!empty($st_ids)) { $query['post__in'] = explode(',', $st_ids); } if ($st_orderby == 'sale') { $query['meta_key'] = 'price'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'rate') { $query['meta_key'] = 'rate_review'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'discount') { $query['meta_key'] = 'discount'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'last_minute_deal') { /*$query['meta_key']='discount'; $query['orderby']='meta_value'; $query['order']='DESC';*/ $query['meta_query'][] = array('key' => 'is_sale_schedule', 'value' => 'on', 'compare' => "="); } if (!empty($sort_taxonomy)) { if (isset($attr["id_term_" . $sort_taxonomy])) { $id_term = $attr["id_term_" . $sort_taxonomy]; $query['tax_query'] = array(array('taxonomy' => $sort_taxonomy, 'field' => 'id', 'terms' => explode(',', $id_term))); } } if ($only_featured_location == 'yes') { $STLocation = new STLocation(); $featured = $STLocation->get_featured_ids(); $query['meta_query'][] = array('key' => 'id_location', 'value' => $featured, 'compare' => "IN"); } if (!empty($st_location)) { $query['meta_query'][] = array('key' => 'id_location', 'value' => $st_location, 'compare' => "IN"); } query_posts($query); if ($st_style == 'style_1') { $r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-tour/loop', '', $data) . "</div>"; } if ($st_style == 'style_2') { $r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-tour/loop2', '', $data) . "</div>"; } if ($st_style == 'style_3') { $r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-tour/loop3', '', $data) . "</div>"; } if ($st_style == 'style_4') { $r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-tour/loop4', '', $data) . "</div>"; } /*TravelHelper::paging();*/ wp_reset_query(); return $r; }
<?php $list_post_type = explode(",", $st_location_header_rate_count_to); $list_star = explode(',', $st_location_star_list); $result = STLocation::get_rate_count($list_star, $list_post_type); ?> <ul class='icon-list text-white bgr-opacity' id='location_header_static'> <?php if (!empty($result) and is_array($result)) { foreach ($result as $key => $value) { $rate_text = __(" rate", ST_TEXTDOMAIN); if ($value > 1) { $rate_text = __(" rates", ST_TEXTDOMAIN); } if ($key == 5) { echo "<li> " . $value . $rate_text . ' <i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i>' . "</li>"; } if ($key == 4) { echo "<li> " . $value . $rate_text . ' <i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i>' . "</li>"; } if ($key == 3) { echo "<li> " . $value . $rate_text . ' <i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i>' . "</li>"; } if ($key == 2) { echo "<li> " . $value . $rate_text . ' <i class="fa fa-star"></i><i class="fa fa-star"></i>' . "</li>"; } if ($key == 1) { echo "<li> " . $value . $rate_text . ' <i class="fa fa-star"></i>' . "</li>"; } } }
public function form($instance) { // title // list post type checkbox // review checkbox // location select if (isset($instance['title'])) { $title = $instance['title']; } else { $title = __('Title', ST_TEXTDOMAIN); } if (isset($instance['post_type'])) { $post_type = $instance['post_type']; } if (isset($instance['count_review'])) { $count_review = $instance['count_review']; } ?> <div class='location_widget_item'> <p> <label ><?php echo balancetags("Title", ST_TEXTDOMAIN); ?> </label> <input value='<?php echo esc_attr($title); ?> ' type='text' name='<?php echo $this->get_field_name('title'); ?> '/> </p> <p> <label><?php echo balancetags("Post type select ", ST_TEXTDOMAIN); ?> </label> <?php $get_post_type_list_active = STLocation::get_post_type_list_active(); if (!empty($get_post_type_list_active) and is_array($get_post_type_list_active)) { foreach (STLocation::get_post_type_list_active() as $key => $value) { ?> <br> <input <?php if (!empty($post_type) and $post_type and in_array($value, $post_type)) { echo esc_attr('checked'); } ?> id ='<?php echo esc_attr("st_w_" . $value); ?> ' value = '<?php echo esc_attr($value); ?> ' type='checkbox' name='<?php echo balancetags($this->get_field_name('post_type')); ?> []'/> <label ><?php echo esc_attr(STLocation::get_post_type_name($value, true)); ?> </label> <?php } } ?> </p> <p> <label><?php echo balancetags("Count Review", ST_TEXTDOMAIN); ?> </label> <input <?php if (!empty($count_review) and $count_review == 'on') { echo "checked"; } ?> type='checkbox' name='<?php echo balancetags($this->get_field_name('count_review')); ?> '/> </p> <p> <label><?php echo esc_attr("Location select", ST_TEXTDOMAIN); ?> </label> <?php $list_location = TravelerObject::get_list_location(); if (!empty($instance['location'])) { $old_location = $instance['location']; } //$old_location = $instance['location']; ?> <select name="<?php echo balancetags($this->get_field_name('location')); ?> " class="form-control"> <option value=""><?php _e('-- Select --', ST_TEXTDOMAIN); ?> </option> <?php foreach ($list_location as $k => $v) { ?> <option <?php if (!empty($old_location) and $old_location == $v['id']) { echo 'selected'; } ?> value="<?php echo esc_html($v['id']); ?> "> <?php echo esc_html($v['title']); ?> </option> <?php } ?> </select> </p> </div> <?php }
"> </div> <?php } ?> <div class="text-small img-left"> <h5><?php the_title(); ?> </h5> <?php $list = TravelHelper::getLocationByParent(get_the_ID()); if (is_array($list) and !empty($list)) { $result = STLocation::get_info_by_post_type(get_the_ID(), $st_type, $list); } else { $result = STLocation::get_info_by_post_type(get_the_ID(), $st_type); } /*$min_price = get_post_meta(get_the_ID() , 'min_price_'.$st_type , true ); $offer = get_post_meta(get_the_ID() , 'offer_'.$st_type , true ); $review = get_post_meta(get_the_ID() , 'review_'.$st_type , true );*/ $min_max_price = $result['min_max_price']; $min_price = $min_max_price['price_min']; $offer = $result['offers']; $review = $result['reviews']; ?> <?php if (!empty($review)) { ?> <p> <?php echo esc_html($review);
<?php $results = STLocation::location_widget3($instance); if (!$instance['title']) { $title = ucfirst($instance['style']); $title .= " " . STLocation::get_post_type_name($instance['post_type']); $title .= " " . __("in", ST_TEXTDOMAIN); $title .= " <strong>" . ucfirst(get_the_title($instance['location'])) . "</strong>"; } else { $title = $instance['title']; } echo "<h4> " . $title . " </h4>"; echo "<ul class='booking-list'>"; if (!empty($results) and is_array($results)) { foreach ($results as $key => $value) { $link = get_permalink($value->ID); $post_id = $value->ID; $thumbnail = get_the_post_thumbnail($post_id, 'full'); if (!$thumbnail) { $thumbnail = st_get_default_image(); } if (isset($instance['layout']) && !empty($instance['layout'])) { $layout = $instance['layout']; } else { $layout = 'layout1'; } ?> <li class='widget_location '> <div class="bookinst_save_attributeg-item booking-item booking-item-small"> <div class="row"> <div class="<?php