I'm trying to display a list of doctors with a map showing the location of the doctors. I've created a view using the Toolset maps. The data-name of my map in the view is "map-1". When I add the view shortcode to a normal page, the data-name of the map is "map-1" and the map shows the pins of the doctors' locations by referring to to "map-1".
When I add the exact same view shortcode to the home page, the map's data-name is "map-1-1". The map pins are set to add to "map-1" and the pins are not added to the map. I've temporarily set the map pins to update "map-1-1" so the pins will display correctly on the home page. This breaks the map on the regular page.
Does the map name get iterated somewhere else in Toolset?
What is the link to your site?
The working map is hidden link. I've temporarily renamed the map pin target to "map-1-1" so the map will work. The broken map is hidden link and the map is named "map-1".
You shouldn't insert the same map over and over again
Instead, you should create a new one, with markers, using the GUI, each time you insert the map and markers
I'm not sure what you mean. The map isn't being created by hand. I'm using the Toolset Maps plugin to generate the map via view. I've created a view to build the map automatically based on the entries in my custom post type. Why does the map ID change on different pages? Shouldn't the view create the same code no matter which page it is inserted in?
My apologies, I thought you are using Blocks. When you do that you would not be able to place a view with a map in several places like you can when you create the View in the classic editor, where the Map will be part of the View loop Output Editor, and hence be inserted with the View when you add it as block or shortcode in a Page or Post.
So, I tested the setup with a classic view on a Home page (static) and it's not adding any other ID than specified in the code in my view. I can see the issue on your site, however.
Can I see this online maybe on a staging site?
I suspect other plugins or something else is changing that ID and would need to do some tests like testing without other plugins, but also re-inserting and analyzing the View itself.
You could also send a Duplicate of the site as seen here https://toolset.com/faq/provide-supporters-copy-site/
Not of this kind, but it would not surprise me either if there would be some sort of conflict, both Plugins are quite powerful and hook deeply into WordPress Core Behaviour, and even if Integrated to some extent this can cause conflicts.
I'd like to see this issue to resolve it. Do you have a staging site where we could take a look? Or, named Duplicate can also help to analyse this.
I can't see either the working nor the broken map on this duplicate
I understand I'd need to add a Map to the homepage, but this is built with Beaver Builder and has several pending updates.
Can you eventually first update the system, then try to insert it without Beaver Builder, and then confirm it is Beaver Builder breaking it?
We can keep beaver builder "in the game", but I would need at least the example where it works (with the builder), so I can mimic that structure in the actual homepage, where we would expect it to break according to your experience.
On the test site, I've updated all of the plugins. I've also added the shortcode to the front page using Beaver Builder (hidden link). On this page, hidden link, it's not using Beaver Builder, just the standard WordPress editor. In both cases, the map is showing up correctly using the same shortcode.
On the live site the Beaver Builder page (hidden link) is showing the map correctly but the non-Beaver Builder page (hidden link), the map is not showing correctly. Both instances are using the same shortcode but one changes the name of the map (map-1 vs map-1-1). I've changed the name of the map in the view to put the map points on the map-1-1 map so it will show up correctly on the home page.
The only thing that should be different now is just the hosting provider. Would that change that map name?
Hi, Beda is currently unavailable so we have redistributed his active tickets among other supporters. I'll be glad to pick up where he left off and try to get this resolved.
I see what you're saying about the hosting provider being the only difference but that's not really a narrow source for the problem if I understand completely. The URLs are different, the Maps API keys are different (leading to potentially different API configurations and permissions), potentially different PHP versions on the server, different MySQL versions, etc... so I think we should try to understand more about why the data-name is changing in some cases. In my experience, the added -1 at the end of the data-name attribute indicates that the system thinks for some reason that there are two map-1's in the DOM. In order to handle the case where map-1 is inserted in the page multiple times, the system is set up to append -1, -2, -3, and so on to the map ID to create unique instances. However, even in the page where map-1-1 is seen here...: hidden link
...I cannot see another instance of map-1 in the source of the page, only the one map-1-1. Plus I see a JS error on this page, stating that the Google Maps API cannot be loaded correctly (Error 403 forbidden):
Failed to load resource: the server responded with a status of 403() <em><u>hidden link</u></em>
Notice there is no "key" parameter in this URL...so the system isn't transmitting an API key with this request. Not sure why that's happening, but it's definitely a problem.
So this is all curious. Just brainstorming here, but is it possible the map shortcode has been inserted in two places with some kind of conditional? One way I can think of that happening is if there is a responsive feature where you have different designs for mobile and desktop resolutions, and the shortcode is inserted twice in the BB design to facilitate that difference. It's possible that this could be tricking the Toolset system into thinking there are two instances of map-1 on the page, resulting in the appended -1 in the second instance.
Are you using any add-on modules for BB that include a Google Maps API key?
Can you go to Settings > Beaver Builder > Tools and clear your caches here?
Thanks for taking over. I don't see the JavaScript error in the console. I've re-entered my map API keys and they seem to check out as well. Maybe that fixed it.
I don't think BB is adding any other maps to that page. I've disabled the Google Maps module in the settings. I've also cleared the cache. Anything else I can try?
FYI, this is not a critical issue so no hurry in getting back to me on this. Eventually, my client will want to add multiple maps so I want to find out what's going on before that time. Thank you!
Actually, I noticed it on the live site. I originally put the shortcode in for the view on this page: hidden link. it worked as expected. The map name was #map-1.
When I put the same shortcode on hidden link, it changed the map name to #map-1-1 and the map wouldn't work. I had to update the map name in the Loop editor to make it work on hidden link. When I did that, hidden link stopped showing the map correctly.
My question is why does the map name change when I put the shortcode on different pages? Does that help?
However, on the live site, it does add the extra "-1" for some reason. Unless you can think of another reason the map ID gets altered, I guess I'll just chalk it up to a plugin conflict. Thanks for your help.