Google Maps: Open a link when the pin is clicked

Is it possible to add a "click link location" to each pin (like https://stackoverflow.com/questions/8769966/google-maps-api-open-url-by-clicking-on-marker)

And I also would like to know if using Custom Fields & Mashups would allow me to link the pin to each post

https://premium.wpmudev.org/wp-content/uploads/2011/04/Google-Maps-Custom-Fields.png
https://premium.wpmudev.org/wp-content/uploads/2011/04/Mashups-1.png

In the meantime is there a way to remove all click actions (I don't want a pop-up or to link to Directions)... I just want a map to be visible, not to be interacted with other than clicking the pin to view that location's information, like a store locator.

  • Kasia Swiderska
    • Support nomad

    Hello Clifford P,

    Is it possible to add a "click link location" to each pin (like https://stackoverflow.com/questions/8769966/google-maps-api-open-url-by-clicking-on-marker)

    At the moment it's not possible without doing changes in the plugin code. But if there will be more members supporting this feature, then our project manager will consider adding it to the plugin.

    And I also would like to know if using Custom Fields & Mashups would allow me to link the pin to each post

    There is this solution provided here - pin doesn't link exactly to post, but there is a bubble with a link to the post, so maybe it will work for you

    https://premium.wpmudev.org/forums/topic/add-location-to-post-and-custom-post-then-show-on-the-map#post-676999

    In the meantime is there a way to remove all click actions (I don't want a pop-up or to link to Directions)... I just want a map to be visible, not to be interacted with other than clicking the pin to view that location's information, like a store locator.

    Let me check with developers if that would be possible with quick code snippet code - if it will be possible we will post the solution here.

    kind regards,
    Kasia

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Clifford P ,

    Could you add this code into your functions.php ( preferably your child-themes ) ?

    This code will hide & remove the directions underneath the map as well as the directions link from the tooltips.

    add_action( 'wp_footer', 'remove_gmaps_actions', 999 );
    function remove_gmaps_actions() {
    	ob_start();
    	?>
    	<style>
    		#agm_mh_footer,
    		.agm_mh_marker_item_directions {
    			display: none;
    		}
    	</style>
    	<script>
    	( function( $ ) {
    		$( document ).ready( function() {
    			setTimeout( function() {
    				$( '#agm_mh_footer' ).remove();
    				$( '.agm_mh_marker_item_directions' ).remove();
    			}, 800 );
    		});
    	} ( jQuery ) );
    	</script>
    	<?php
    	$scripts = ob_get_clean();
    	echo $scripts;
    }

    Tell me if you need further help customizing this!

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.