Is there an example of how to create a map showing custom markers inside a view I could take a look at.
Reading the documentation may work for some, however, I work quicker seeing an example.
Do I render the map inside or outside the view?
I've tried rendering the map inside the view (outside the loop) with markers inside the loop, however, nothing shows.
Many thanks.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Hayley,
Thank you for getting in touch.
Can you provide a screenshot of the Map shortcode in your view as well as the marker shortcode ?
Secondly if you are using our Toolset Blocks plugin this makes it much easier to setup your map on the page.
Have a look at this documentation below if you've not already seen it.
https://toolset.com/course-lesson/displaying-a-list-of-posts-on-a-map/
Thanks,
Shane
Hi Shane,
Thank you for getting back to me.
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
[wpv-map-render map_id="map-39"]
<wpv-loop>
[wpv-map-render map_id="map-39"] [wpv-map-marker map_id='map-39' marker_id='marker-38' marker_icon='//staticcaravanbuyer.com/wp-content/uploads/2020/08/MAP-MARKER-300x300.png' marker_field='wpcf-hh-park-url-hh'][/wpv-map-marker]
</wpv-loop>
[/wpv-map-render]
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
This was a test map that I tried to create.
However, nothing shows within this view.
I have selected the correct post type, 0 filter or sorting.
Any guidance would be appreciated.
Many Thanks
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Hayley,
Thank you for providing me with the code for this.
I see some small issues with this code.
Can you try it like this.
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
[wpv-map-render map_id="map-39"]
<wpv-loop>
[wpv-map-marker map_id='map-39' marker_id='marker-38' marker_icon='//staticcaravanbuyer.com/wp-content/uploads/2020/08/MAP-MARKER-300x300.png' marker_field='wpcf-hh-park-url-hh'][/wpv-map-marker]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
Please try this code above and let me know if it works. The Map render shortcode doesn't need a closing tag to function.
Thanks,
Shane