From ef13af90b8a8e034b924b099bf65c74c6c728350 Mon Sep 17 00:00:00 2001 From: rboren Date: Mon, 26 Apr 2004 02:34:07 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 12 +++++++++--- wp-includes/template-functions-geo.php | 18 ++++++++++++++++-- wp-includes/vars.php | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d9be6696eb..782f1d09d1 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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; diff --git a/wp-includes/template-functions-geo.php b/wp-includes/template-functions-geo.php index f3f93143b4..aa799b0679 100644 --- a/wp-includes/template-functions-geo.php +++ b/wp-includes/template-functions-geo.php @@ -1,12 +1,26 @@ post_lat; + + 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; - return $post->post_lon; + + 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() { diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 579f60301b..0acb1d5dbe 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -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'); ?> \ No newline at end of file