当前位置: 首页>>代码示例>>PHP>>正文


PHP TravelHelper::edit_join_wpml方法代码示例

本文整理汇总了PHP中TravelHelper::edit_join_wpml方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::edit_join_wpml方法的具体用法?PHP TravelHelper::edit_join_wpml怎么用?PHP TravelHelper::edit_join_wpml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TravelHelper的用法示例。


在下文中一共展示了TravelHelper::edit_join_wpml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_near_by_lat_lng

 function get_near_by_lat_lng($lat = false, $lng = false, $post_type = array(), $range = 20, $limit = 5)
 {
     $map_lat = (double) $lat;
     $map_lng = (double) $lng;
     //Search by Kilometer :6371
     //Miles: 3959
     if (!empty($post_type) and is_array($post_type)) {
         $data_post_type = "";
         foreach ($post_type as $k => $v) {
             $data_post_type .= "'" . $v . "',";
         }
         $data_post_type = substr($data_post_type, 0, -1);
         global $wpdb;
         $where = "{$wpdb->posts}.ID = mt1.post_id\r\n            and {$wpdb->posts}.ID=mt2.post_id\r\n            AND mt1.meta_key = 'map_lat'\r\n            and mt2.meta_key = 'map_lng'\r\n            AND {$wpdb->posts}.post_status = 'publish'\r\n            AND {$wpdb->posts}.post_type IN ({$data_post_type})\r\n            AND {$wpdb->posts}.post_date < NOW()";
         $where = TravelHelper::edit_where_wpml($where);
         $join = "";
         $join = TravelHelper::edit_join_wpml($join, $post_type);
         $querystr = "\r\n            SELECT {$wpdb->posts}.*,( 6371 * acos( cos( radians({$map_lat}) ) * cos( radians( mt1.meta_value ) ) *\r\ncos( radians( mt2.meta_value ) - radians({$map_lng}) ) + sin( radians({$map_lat}) ) *\r\nsin( radians( mt1.meta_value ) ) ) ) AS distance\r\n            FROM {$wpdb->posts} {$join}, {$wpdb->postmeta} as mt1,{$wpdb->postmeta} as mt2\r\n            WHERE (1=1) and {$where}\r\n            GROUP BY {$wpdb->posts}.ID HAVING distance<{$range}\r\n            ORDER BY distance ASC\r\n            LIMIT 0,{$limit}\r\n         ";
         $pageposts = $wpdb->get_results($querystr, OBJECT);
         //set_transient( 'st_items_nearby_' . $post_id , $pageposts , 5 * HOUR_IN_SECONDS );
         return $pageposts;
     }
     return false;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:24,代码来源:class.travelobject.php


注:本文中的TravelHelper::edit_join_wpml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。