开发者 | fyaconiello |
---|---|
更新时间 | 2012年8月21日 04:32 |
捐献地址: | 去捐款 |
PHP版本: | 3.0 及以上 |
WordPress版本: | 3.4.1 |
版权: | GPL2 |
版权网址: | 版权信息 |
location
, latitude
, and longitude
meta + metaboxes to any content type.WP_GeoQuery
an extended WP_Query
class for doing distance based and geo-aware queries.within radius
option to WP_GeoQueryChange Location
(stored as COOKIE)Get Directions
link (utilizing Google Maps)within radius
calls)wp-geo-posts
folder to the /wp-content/plugins/
directory.Plugins
menu in WordPress.Settings
link on the plugin management page OR click the WP GeoPosts
link from the Settings flyout menu.Save Changes
.For every post type selected on the plugin settings page. That type's add/edit screens will have an additional metabox automatically added. Metadata that is added to each record:
wp_gp_location
wp_gp_latitude
wp_gp_longitude
Make a geo-aware query against the posts table. WP_GeoQuery
accepts all arguments that WP_Query
takes. latitude
and longitude
are optional parameters. If passed, distance
is calculated and returned with each result. In addition to the regular fields, each result returns latitude
, longitude
, and location
.
`
'37.5160', // User's Latitude (optional)
'longitude' => '-77.5005', // User's Longitude (optional)
'posts_per_page' => 25, // Any regular options available via WP_Query
));
foreach($query->posts as $post)
{
echo " {$post->post_title}\n";
// returned only if latitude and longitude are passed into WP_GeoQuery
echo " {$post->distance}\n";
// Always returned by WP_GeoQuery
echo " {$post->location}\n";
echo " {$post->latitude}\n";
echo " {$post->longitude}\n";
echo "\n";
}
?>
`