[Resuelto] Issues generating map with multiple markers
Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
Problem:
Markers are not displaying on a map.
Solution:
The client was inserting the same map twice (using the wpv-map-render shortcode twice with the same id) onto the same page which broke its functionality.
This support ticket is created hace 6 años, 5 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
I am trying to: Show a map at top of page, with a marker for each member in the displayed view
Link to a page where the issue can be seen: enlace oculto
I expected to see: A map with lots of markers, automatically centered on them
Instead, I got: A map with no markers, centered in middle of Atlantic Ocean
The view is here: enlace oculto
In the source code I noticed it created a map-directory-1, while the markers are added to map-directory. i have no idea why that happened.
It's definitely an issue with the view setup. The test works and the maps on the member pages work now that I got the proper setup from Christian. I appreciate you picking this ticket up since Christian won't be in till much later...
I tried to get the map to work outside the view, but could not get it to show at all. So I put it back in the view code... but for some reason a new map id was generated. I set it to map-directory, and that's the map that the markers are added to in the view; however in the source code I see map-directory-1 for the map itself and map-directory for the markers. I don't know how to reset the map id to make it work. If there's a way to get the map to show up at the top of the page where the view appears, that would be even better.
I created a test View and test page to display a map to confirm it should be working okay, which it was, so I've deleted those.
I wondered if there were some issue with the map marker shortcode being inside the template that you designed with Divi. Because the markers are added to the map it doesn't matter where they are inserted as long as they are inserted within the wpv-loop tags, so I removed them from the Divi-designed template and inserted the marker shortcode directly inside the Loop Output section, after the opening wpv-loop tag.
It didn't help, but it didn't hurt, and is probably good to know.
Lastly I looked at the page where you insert the View itself, which is where I identified the problem.
You have inserted the map shortcode in the filter controls section of your View (so that it appears before the filters).
But you also inserted the same map shortcode directly in its own module before the module where you inserted the search filters, meaning you were trying to add the same map (i.e. with the same id) twice, which is what broke the expected display.
I deleted the module where you had inserted the map a second time and it looks like it is working fine now if you want to confirm.
Great work, Nigel. I actually noticed it was fixed and then checked my email to see if you'd done something... it makes a lot of sense that inserting twice caused the wrong id issue. Thanks so much for straightening it out. I'm pretty good with toolset (I'm a toolset contractor) but I'm still learning about the maps.