"Get directions" button to open Google Map

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

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

Open Support Ticket
  • Author
    Posts
  • #542893

    Anton Noe
    Expired Member

    Hi everyone,

    I have a quick question. Is it possible to have the “get directions” button open Google maps?

    The code that I did found is from a few years back it isn’t working, unfortunately.

    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 ) ) {
    $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_map_after_render’, ‘geodirectory_detail_page_google_map_link’, 10, 2 );

    Thank you for your time and help!

    #542905

    Kor
    Moderator
    Post count: 16516

    Hi Anton Noe,

    Thanks for your post. Kindly share both WP and FTP access here in private reply and I’ll get a developer to check on this.

    Thanks!

    #542926

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    for GDV2 you don’t need a snippet.

    Just add the GD Post Directions element

    https://wpgeodirectory.com/docs-v2/geodirectory/design-elements/#gd_post_directions

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount