Direction Link Below The Map

This topic contains 5 replies, has 2 voices, and was last updated by  Alex Rollin 4 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #477334

    Barbara Magee
    Expired Member
    Post count: 146

    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’);

    #477337

    Alex Rollin
    Moderator
    Post count: 27815
    #478632

    Barbara Magee
    Expired Member
    Post count: 146

    Hi 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.

    #478654

    Barbara Magee
    Expired Member
    Post count: 146

    Okay, 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 ) ) {

    ?>

    <p>post_latitude . ‘,’ . $post->post_longitude ;?>” target=”_blank”><?php echo __( ‘Get Directions on Google Maps’, ‘geodirectory’ ); ?></p>

    <?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!!

    #478660

    Barbara Magee
    Expired Member
    Post count: 146
    #478754

    Alex Rollin
    Moderator
    Post count: 27815

    The 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_directions

    On your widgets page use ctrl+f to find “directions” and you will find it there.

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket