Geo enhancements. Allow get_Lat and get_Lon to be called outside of the post loop. Add doGeoUrlHeader as an action on wp_head.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
08e7857fcf
commit
ef13af90b8
|
@ -867,10 +867,16 @@ function pingback($content, $post_ID) {
|
|||
debug_fclose($log);
|
||||
}
|
||||
|
||||
function doGeoUrlHeader($posts) {
|
||||
if (count($posts) == 1) {
|
||||
function doGeoUrlHeader($post_list = '') {
|
||||
global $posts;
|
||||
|
||||
if (empty($post_list)) {
|
||||
$post_list = $posts;
|
||||
}
|
||||
|
||||
if (count($post_list) == 1) {
|
||||
// there's only one result see if it has a geo code
|
||||
$row = $posts[0];
|
||||
$row = $post_list[0];
|
||||
$lat = $row->post_lat;
|
||||
$lon = $row->post_lon;
|
||||
$title = $row->post_title;
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
<?php
|
||||
function get_Lat() {
|
||||
global $post;
|
||||
|
||||
if ($post->post_lat != '') {
|
||||
return $post->post_lat;
|
||||
} else if(get_settings('use_default_geourl')) {
|
||||
return get_settings('default_geourl_lat');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function get_Lon() {
|
||||
global $post;
|
||||
|
||||
if ($post->post_lon != '') {
|
||||
return $post->post_lon;
|
||||
} else if(get_settings('use_default_geourl')) {
|
||||
return get_settings('default_geourl_lon');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function print_Lat() {
|
||||
|
|
|
@ -182,5 +182,5 @@ add_filter('single_post_title', 'wptexturize');
|
|||
add_filter('the_title', 'wptexturize');
|
||||
add_filter('the_content', 'wptexturize');
|
||||
add_filter('the_excerpt', 'wptexturize');
|
||||
|
||||
add_action('wp_head', 'doGeoUrlHeader');
|
||||
?>
|
Loading…
Reference in New Issue