开发者 | niksudan |
---|---|
更新时间 | 2015年3月5日 22:36 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
wp-post-distance-filter
folder to your plugins directory, then activate the plugin in the Plugins menu. An option should appear under Settings.
Changing Options
On the options page you'll have a few settings that you can change to make the plugin work to your liking.
meta_keys
that the plugin uses when calculating the distance for each postmeta_key
and specify the value you want it to show. After updating the post, two more custom fields should appear - the lat and lng keys if done correctly.
Filtering Posts
For any archive page, if the URL location parameter is specified, it will order by distance. You can limit the number of results using the URL radius parameter.
You can show distance information using the_distance();
and get_the_distance();
within the wordpress loop.
if (have_posts()) : while (have_posts()) : the_post();
the_title();
the_content();
the_distance();
endwhile; endif;Make sure that your URL parameters are correct and the plugin is enabled.
Make sure nothing else is using the post's lat and lng meta_keys. If they are, consider changing their names on the options page.
Make sure that you've specified a location
You need to enable the custom field option by clicking the post dropdown at the very top of the page.