Direction Link Below The Map
This topic contains 5 replies, has 2 voices, and was last updated by Alex Rollin 5 years, 7 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: directions, maps, mobile
-
AuthorPosts
-
April 1, 2019 at 2:04 pm #477334
Hi,
We want to add a direction link below the Map on the listing details page. We are using GDV2.
For GDV1 we find out some code snippet for this one but For GDV2 we are not able to get it and the code is not working on GDV2. We also tried different shortcode parameter for Map. Can You Guys have a look in to it and let us know how we can do this.Code snippet for GDV1
——————————
function geodirectory_detail_page_google_map_link() {
global $post, $preview;if ( !$preview && !empty( $post->post_latitude ) && !empty( $post->post_longitude ) ) {
$maps_url = add_query_arg( array(
‘q’ => get_the_title(),
‘sll’ => $post->post_latitude . ‘,’ . $post->post_longitude,
), ‘http://maps.google.com/’ );
?>
<p>” target=”_blank”><?php echo __( ‘Get Directions on Google Maps’, ‘geodirectory’ ); ?></p>
<?php
}
}
add_action( ‘geodir_after_description_on_listing_detail’, ‘geodirectory_detail_page_google_map_link’);April 1, 2019 at 2:18 pm #477337That is now available as a widget in GDV2
https://wpgeodirectory.com/docs-v2/geodirectory/design-elements/#gd_post_directionsApril 5, 2019 at 3:23 pm #478632Hi Alex,
BUt still we are not able to figure out how to get the GEt Direction Button. We tried the Shortcode but unable to find out. Can you guide us how to get those.April 5, 2019 at 4:11 pm #478654Okay, we inserted the shortcode on our details listing page template to display the map with the Get Directions field underneath it. We have a few questions about the map setup:
Map to open in Google maps app:
A support forum posting on 12/10/18 about getting map Directions on detail page to open in Google map app was on this page:
It referred people to this page from 2016:
Here is the code.
function geodirectory_detail_page_google_map_link( $options, $canvas ) {
global $post;
if ( $canvas == ‘detail_page_map_canvas’ && !empty( $post->post_latitude ) && !empty( $post->post_longitude ) ) {
?>
<?php
}
}
add_action( ‘geodir_map_after_render’, ‘geodirectory_detail_page_google_map_link’, 10, 2 );
Does this code automatically insert a different button under the detail listing page map for mobile users to click?
Or Does the code replace the function of the existing right justified Get Directions button?
Do the existing address entry field under the map and the Get directions button to the right remain for desktop users?
When walking or bicycling or public transport are selected per the attached image it indicates beta status. Has this been resolved in the recent GDV2 release version?
Thanks very much!!
April 5, 2019 at 4:21 pm #478660Here are the links to the support posts about google maps referred to in our previous post:
https://wpgeodirectory.com/support/topic/open-place-map-in-mobile-google-maps-app/#post-457809.
https://wpgeodirectory.com/support/topic/get-directions-button-to-open-google-maps-link/#post-233095
April 5, 2019 at 11:33 pm #478754The element can be placed in the sidebar as a widget or in the archive item or detail template as a shortcode.
https://wpgeodirectory.com/docs-v2/geodirectory/design-elements/#gd_post_directionsOn your widgets page use ctrl+f to find “directions” and you will find it there.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket