コード例 #1
0
ファイル: rental.php プロジェクト: DaddyFool/travelTest
 function st_rental_detail_map($attr)
 {
     if (is_singular('st_rental')) {
         $default = array('number' => '12', 'range' => '20', 'show_circle' => 'no');
         extract($dump = 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);
         $class = new STRental();
         $data = $class->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/rental', 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/rental', 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_rental_icon_map_marker', 'http://maps.google.com/mapfiles/marker_yellow.png');
                     $data_map[$stt]['content_html'] = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', st()->load_template('vc-elements/st-list-map/loop/rental', 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/rental', 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;
     }
 }
コード例 #2
0
ファイル: nearby.php プロジェクト: HatchForce/bachtraveller
<?php

/**
 * @package WordPress
 * @subpackage Traveler
 * @since 1.0
 *
 * Rental nearby
 *
 * Created by ShineTheme
 *
 */
$object = new STRental();
$nearby_posts = $object->get_near_by();
$default = array('show_title' => true, 'class' => '');
if (isset($arg)) {
    extract(wp_parse_args($arg, $default));
} else {
    extract($default);
}
if ($show_title) {
    ?>
    <h4><?php 
    printf(st_get_language('rental_properties_near_d'), '<span class="title_nearby">' . get_the_title() . '</span>');
    ?>
</h4>
<?php 
}
if ($nearby_posts and !empty($nearby_posts)) {
    global $post;
    echo "<ul class='booking-list {$class}' >";