Maps with coordinates

Home Forums Calendar Products Events Calendar PRO Maps with coordinates

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1222283
    Adage
    Participant

    Hello,

    I am using maps with lat long coordinates for venues.

    But when I click on “open in google maps” on single venue page, the map loads the address instead of the coordinates.

    How may I force loading the map with coordinates ?

    Thank you.

    #1222937
    Nico
    Member

    Hi there Adage,

    Thanks for reaching out to us! Hopefully this is possible by pasting the snippet below in your theme’s (or child theme’s) functions.php file:

    /* Tribe, override google map link with one build on coordinates */
    function tribe_coordinates_url ( $url, $post_id ){
    $coordinates = tribe_get_coordinates ( $post_id );

    // bail if no coordinates
    if ( !$coordinates['lat'] || !$coordinates['lng'] ) return $url;

    //build new URL with coordinates
    $url = 'https://maps.google.com/?q=' . $coordinates['lat'] . ',' . $coordinates['lng'];

    return $url;
    }
    add_filter( 'tribe_events_google_map_link', 'tribe_coordinates_url', 10, 2 );

    Please give this a try and let me know if it works for you,
    Best,
    Nico

    #1222943
    Adage
    Participant

    This is just perfect !
    Thank you very much !

    #1223136
    Nico
    Member

    Wooot! You are welcome 🙂

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Maps with coordinates’ is closed to new replies.