GeoDirectory SupportGetting Current Location's Country? – GeoDirectory Support https://wpgeodirectory.com/support/topic/getting-current-locations-country/feed Thu, 05 Feb 2026 13:27:50 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/getting-current-locations-country/#post-18882 <![CDATA[Getting Current Location's Country?]]> https://wpgeodirectory.com/support/topic/getting-current-locations-country/#post-18882 Sun, 19 Oct 2014 17:22:59 +0000 Greg McEwan Marriott Hi, You guys have already helped me (thank you) managing to use the geodir_get_current_location function to return the current location as in city… is there an easy way to get City, Country? Does the geodir_get_current_location array contain anything else than the city name?

]]>
https://wpgeodirectory.com/support/topic/getting-current-locations-country/#post-18896 <![CDATA[Reply To: Getting Current Location's Country?]]> https://wpgeodirectory.com/support/topic/getting-current-locations-country/#post-18896 Sun, 19 Oct 2014 22:24:02 +0000 Simone Hello, I created this function to obtain the value you are looking for (and place it in the detail page), if you read it, it is easily understandable and you can use it whenever you want


add_action( 'geodir_after_listing_post_title', 'country_listing', 45 );
function country_listing() {
global $post;
global $wp_query;

$postid = $wp_query->post->ID;
$postcity= geodir_get_post_meta($postid,'post_city',true); 
$postregion= geodir_get_post_meta($postid,'post_region',true); 
$postcountry= geodir_get_post_meta($postid,'post_country',true); 

echo $postcountry." - ".$postregion." - ".$postcity;

}
]]>
https://wpgeodirectory.com/support/topic/getting-current-locations-country/#post-18949 <![CDATA[Reply To: Getting Current Location's Country?]]> https://wpgeodirectory.com/support/topic/getting-current-locations-country/#post-18949 Mon, 20 Oct 2014 16:15:13 +0000 Paolo The code I gave you the other day should work for all locations, not only cities.

Thx

]]>