Exemplo n.º 1
0
 function st_hotel_detail_map($attr)
 {
     if (is_singular('st_hotel')) {
         $hotel = new STHotel();
         $data = $hotel->get_near_by(get_the_ID(), 200, 10);
         $default = array('number' => '12', 'range' => '20', 'show_circle' => 'no');
         extract(wp_parse_args($attr, $default));
         $lat = get_post_meta(get_the_ID(), 'map_lat', true);
         $lng = get_post_meta(get_the_ID(), 'map_lng', true);
         $zoom = get_post_meta(get_the_ID(), 'map_zoom', true);
         $hotel = new STHotel();
         $data = $hotel->get_near_by(get_the_ID(), $range, $number);
         $location_center = '[' . $lat . ',' . $lng . ']';
         $data_map = array();
         $data_map[0]['id'] = get_the_ID();
         $data_map[0]['name'] = get_the_title();
         $data_map[0]['post_type'] = get_post_type();
         $data_map[0]['lat'] = $lat;
         $data_map[0]['lng'] = $lng;
         $data_map[0]['icon_mk'] = get_template_directory_uri() . '/img/mk-single.png';
         $data_map[0]['content_html'] = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', st()->load_template('vc-elements/st-list-map/loop/hotel', false, array('post_type' => '')));
         $data_map[0]['content_adv_html'] = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', st()->load_template('vc-elements/st-list-map/loop-adv/hotel', false, array('post_type' => '')));
         $stt = 1;
         global $post;
         if (!empty($data)) {
             foreach ($data as $post) {
                 setup_postdata($post);
                 $map_lat = get_post_meta(get_the_ID(), 'map_lat', true);
                 $map_lng = get_post_meta(get_the_ID(), 'map_lng', true);
                 if (!empty($map_lat) and !empty($map_lng) and is_numeric($map_lat) and is_numeric($map_lng)) {
                     $post_type = get_post_type();
                     $data_map[$stt]['id'] = get_the_ID();
                     $data_map[$stt]['name'] = get_the_title();
                     $data_map[$stt]['post_type'] = $post_type;
                     $data_map[$stt]['lat'] = $map_lat;
                     $data_map[$stt]['lng'] = $map_lng;
                     $data_map[$stt]['icon_mk'] = st()->get_option('st_hotel_icon_map_marker', 'http://maps.google.com/mapfiles/marker_black.png');
                     $data_map[$stt]['content_html'] = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', st()->load_template('vc-elements/st-list-map/loop/hotel', false, array('post_type' => '')));
                     $data_map[$stt]['content_adv_html'] = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', st()->load_template('vc-elements/st-list-map/loop-adv/hotel', false, array('post_type' => '')));
                     $stt++;
                 }
             }
             wp_reset_postdata();
         }
         if ($location_center == '[,]') {
             $location_center = '[0,0]';
         }
         if ($show_circle == 'no') {
             $range = 0;
         }
         $data_tmp = array('location_center' => $location_center, 'zoom' => $zoom, 'data_map' => $data_map, 'height' => 500, 'style_map' => 'normal', 'number' => $number, 'range' => $range);
         $data_tmp['data_tmp'] = $data_tmp;
         $html = '<div class="map_single">' . st()->load_template('hotel/elements/detail', 'map', $data_tmp) . '</div>';
         return $html;
     }
 }
Exemplo n.º 2
0
<?php

/**
 * @package WordPress
 * @subpackage Traveler
 * @since 1.0
 *
 * Hotel nearby
 *
 * Created by ShineTheme
 *
 */
$hotel = new STHotel();
$nearby_posts = $hotel->get_near_by();
$title = st_get_language('hotel_near');
if (!empty($nearby_posts)) {
    if (count($nearby_posts) > 1) {
        $title = st_get_language('hotels_near');
    }
}
?>
    <h4><?php 
echo esc_html($title);
?>
        <span class="title_bol"><?php 
echo the_title();
?>
</span>
    </h4>
<?php 
if ($nearby_posts and !empty($nearby_posts)) {