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_func($attr) { $data = shortcode_atts(array('st_location_custom_type' => '', 'st_location_post_type' => 'st_hotel', 'st_location_number_offers' => '', 'st_location_number_reviews' => '', 'st_location_price_custom' => '', 'st_location_post_type_thumb' => ''), $attr, 'st_location'); extract($data); if (!is_singular('location')) { return; } $post_type = $st_location_post_type; if ($st_location_custom_type == "custom") { $array = array('post_type' => $st_location_post_type, 'thumb' => $st_location_post_type_thumb, 'post_type_name' => get_post_type_object($post_type)->labels->name, 'reviews' => $st_location_number_reviews, 'offers' => $st_location_number_offers, 'min_max_price' => array('price_min' => $st_location_price_custom)); } else { // get infomation from location ID $array = STLocation::get_info_by_post_type(get_the_ID(), $post_type); $array['thumb'] = $attr['st_location_post_type_thumb']; $array['post_type'] = $attr['st_location_post_type']; } return st()->load_template('location/location-content-item', null, $array); }
"> </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 $count_car = STLocation::get_info_by_post_type(get_the_ID(), 'st_cars'); $count_tours = STLocation::get_info_by_post_type(get_the_ID(), 'st_tours'); $count_hotel = STLocation::get_info_by_post_type(get_the_ID(), 'st_hotel'); $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');
?> <h4><?php if (!$title) { echo __("Largest Selection", ST_TEXTDOMAIN); } else { echo esc_html($title); } ?> </h4> <p> <?php if (!empty($post_type) and is_array($post_type)) { $count_review = 0; foreach ($post_type as $key => $value) { $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