GeoDirectory SupportPlace code to open Google Maps in a different location – GeoDirectory Support https://wpgeodirectory.com/support/topic/place-code-to-open-google-maps-in-a-different-location/feed Sat, 15 Mar 2025 14:16:26 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/place-code-to-open-google-maps-in-a-different-location/#post-39778 <![CDATA[Place code to open Google Maps in a different location]]> https://wpgeodirectory.com/support/topic/place-code-to-open-google-maps-in-a-different-location/#post-39778 Mon, 18 May 2015 03:37:25 +0000 leonce153 I’m using this code in function.php from a previous post to allow users to get directions from Google Maps:

add_action(‘geodir_after_social_sharing_buttons’ , ‘buttonmap’, 10);
function buttonmap(){
global $post, $wp_query, $preview, $geodirectory;
$postid = $wp_query->post->ID;
$address= geodir_get_post_meta($postid,’post_address’,true); //address
$e_add = str_replace(‘ ‘, ‘+’, $address); // + in space eg road+street+23

$lat= geodir_get_post_meta($postid,’post_latitude’,true); //lat
$lon= geodir_get_post_meta($postid,’post_longitude’,true); //lon
//echo $e_add.$lat.$lon;

echo “Get Directions“;
}

What I’m hoping you can help with is I want to place it just below the business listing address, but not sure what to replace this with to do so:

geodir_after_social_sharing_buttons

]]>
https://wpgeodirectory.com/support/topic/place-code-to-open-google-maps-in-a-different-location/#post-39789 <![CDATA[Reply To: Place code to open Google Maps in a different location]]> https://wpgeodirectory.com/support/topic/place-code-to-open-google-maps-in-a-different-location/#post-39789 Mon, 18 May 2015 11:47:08 +0000 Simone You can try with this


geodir_after_detail_page_more_info

rather than


geodir_after_social_sharing_buttons

and it will place after the block with the address (not right after the address)

(PS: when you paste a block of code, please wrap it in the code button, here in the forum)

]]>