Open Map link in new window?

New home Forums Pro Add-on General queries Open Map link in new window?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #24333
    jwebadgility
    Member

    Hi – I’ve purchased the plugin and am currently using it. I’d like to see how I could add a link in the actual location bubble to ‘Open Map in Window’ – so a user could click the link and a new window would open to the full google maps page with the location pinned. Is there a way to do that in the options?

    #24345
    Dylan
    Moderator

    Hi there,

    Thank you so much for getting in touch with us.

    Our description field supports the use of HTML tags and therefore it is possible to create an ‘a’ (link) tag with the attribute ‘target’ set to ‘_blank’ (This will open a new tab).

    However retrieving the current markers lat/lng (to be sent to maps.google.com) would require changes to the core functionality.

    Are you open to this? If so I could assist you in modifying some of the core functionality to support this.

    #24360
    jwebadgility
    Member

    Hi Dylan,

    Thanks for the response. I have an interest in doing this, but not sure I have the technical know-how to accomplish it. Happy to help though if you can give me some direction.

    Thanks,
    Jeff

    #24376
    Dylan
    Moderator

    Hi Jeff,

    Not a problem at all, I completely understand.

    We have very similar functionality built into our ‘Get Directions’ functionality. Specifically, when on mobile devices, the link will point directly to maps.google.com – as such I believe I may have a simpler change which will do the same thing essentially.

    Would you be open to using the ‘Get Directions’ functionality in your map, and then editing the code (with my guidance) alter the ‘title’ of the ‘Get Directions link to ‘Open Map in Window’ instead?

    #24398
    jwebadgility
    Member

    Dylan,

    That sounds worth trying out to me. I’ll be able to do that if you point me to the file.

    Thanks,
    Jeff

    #24434
    Dylan
    Moderator

    Hi Jeff,

    Not a problem, more than happy to help with this.

    Please follow the steps below to achieve this:
    1. Open the ‘wp-google-maps-pro.php’ file of the plugin (plugins/wp-google-maps-pro/wp-google-maps-pro.php)
    2. Find the following line of code:

    wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_get_dir', apply_filters( "wpgmza_filter_change_get_directions_string", __( "Get directions", "wp-google-maps" ) ) );

    3. Change it to the following instead:

    wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_get_dir', apply_filters( "wpgmza_filter_change_get_directions_string", __( "Open Map in Window", "wp-google-maps" ) ) );

    4. Save this file. This should change the link in the info-window.
    5. Now open the ‘core.js’ file (plugins/wp-google-maps-pro/js/core.js
    6. Find the following segment of code:

    if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {    
            if( (navigator.platform.indexOf("iPhone") != -1)
            || (navigator.platform.indexOf("iPod") != -1)
            || (navigator.platform.indexOf("iPad") != -1))
            window.open("maps://maps.google.com/maps?daddr="+latLong+"&ll=");
            else
            window.open("http://maps.google.com/maps?daddr="+latLong+"&ll=");
    } else {
    
            jQuery("#wpgmaps_directions_edit_"+wpgmzamid).show();
            jQuery("#wpgmaps_directions_editbox_"+wpgmzamid).show();
            jQuery("#wpgmza_input_to_"+wpgmzamid).val(end.length > 0 ? end : latLong);
            jQuery("#wpgmza_input_from_"+wpgmzamid).focus().select();
    }

    7. Replace it with the following instead:

    window.open("http://maps.google.com/maps?daddr="+latLong+"&ll=");

    8. Save this file as well.
    9. The last step is to open the map in the map editor and enable the directions functionality.

    I hope this helps? 🙂

    #24455
    jwebadgility
    Member

    Thanks Dylan – I’ll give this a try in the next few days and report back!

    -Jeff

    #24490
    Dylan
    Moderator

    Hi Jeff,

    Not a problem at all, I hope this helps.

    🙂

    #29828
    Sasha
    Member

    Hello.

    i put link into marker… i want to click marker and go to link in NEW WINDOW.

    how i can do this????

    #29868
    Dylan
    Moderator

    Hi Sasha,

    Thank you so much for getting in touch, we really appreciate your time.

    When using the ‘Link URL’ field (seen when creating a marker), to add a marker link you are able to control whether this marker opens in a new window.

    This can be enabled by clicking on Maps -> Settings -> InfoWindows (tab) -> And enabling the option labelled ‘Open links in a new window’.

    I hope this helps? 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.