Is there a way to link to a page on which there is a google map with multiple markers – and pre select one of those markers?




This is possible via url redirect , when you click on a any link you will redirect to your map url. Before this you need to create a map with multiple locations.

I have a map with multiple markers already. How do I link to it so that my choice of marker is pre-selected?
Only map redirection is possible, pre selection of marker is not possible. Can you send me any live example so we can check it.

It sounds as though you're not offering a way to do this at all... presumably though I could add a javascript document.ready function which can call your function to load up the selected marker? Can you tell me the function name I'd need to call?

Without the ability to do this, and without the ability to show a map of a single location on each custom post page, there's a big gap in the functionality of your plugin I think.

Posting a live link privately in a moment.
Found a way to show single markers on a map on the custom post type's own page so I don't need the link to auto-highlight one of many on the multi-marker map any more. Details posted in this other thread:

However it would be super to be able to do as asked above. If I have some time I'll find a way and post it here.
Thank you very much for your cooperation and support. We love to hear from your side.

I've worked out how to do this IF you're displaying the list of markers under the map. All I've done is wait for document readiness then ID a value is passed in the URL for 'pid' then some JS runs to find the item title, and trigger a click event - thus simulating a person clicking on the correct item.

You'll need to ensure the item in question is going to be visible on the page once loaded for this to work so it won't be great if you're making using of pagination. It's a start though. If you _are_ using pagination and you know the correct page you could do something similar and first select the correct page, then find the item, then trigger the click.

I'm sure there's a nice way to do this but it works for now...

Link to the map URL and add ?pid=xxx where xxx is the post_id.

In the custom code for the list items, edit the list item so that the 'a' element inserted before the {marker_title} item contains a referenceable ID e.g. I have this:


Then in your template file which drives the multiple marker WP Google Map page make sure it contains this code:

$id = intval($_GET['pid']);
if ($id > 0) {
return '

$(document).ready(function() {
$("a#ftrm'.$id.'" ).next().click();

This may seem incorrect with the .next() selector but in fact FlipperCode replace the single element with two in the final output - and you need to trigger the click on the second .

Again if you want help with this contact @Aetherweb.
Thank you very much for help and support. Its really appreciated we will definitely discuss this in our upcoming meeting and if we need any help we will definitely contact you.

Haha I didn't expect you guys at Flippercode to need my help but sure, you're welcome!

If you could add my ideas to the plugin as options more easily implemented that would be great. To summarise them:

1] Have a shortcode that if added to the page of a custom post, it shows some selected map but with JUST that one marker of the custom post.

2] Take a URL parameter so a link to a map with multiple markers can pre-select a particular one when it's loaded.
Thanks Again :)

This question is now closed