Skip Navigation

[Résolu] Map markers generate Javascript error if contain full stops or brackets

This support ticket is created Il y a 4 années et 5 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 réponses, has 2 voix.

Last updated by Gavin Il y a 4 années et 5 mois.

Assisted by: Waqar.

Auteur
Publications
#1372023
mapmarkererror.png

Hello

I have a Post Type called Map Markers and I am displaying these on a map. All is working fine. However, two of my Map Markers generated Javascript errors (which I noticed when my Bootstrap 4.0 menu stopped working).

One was called St. Mary's Church and the other was called Royal Marine Barracks (Exiles Club).

When I removed the full stop from the first and the brackets from the second, I got no Javascript error.

Thanks

Gavin

#1372201

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Gavin,

Thank you for contacting us and I'd be happy to assist.

I've performed some tests on my website and was able to reproduce the error from your screenshot, only when the post's title was used in the ID of the marker.

Example:


[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-title]' marker_field='wpcf-field-slug'][/wpv-map-marker]

Using the title for the marker's ID is not a very good idea in the first place and you can replace it with the post's ID instead, which will always be unique for all posts and would also only consist of numbers.
( ref: https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#displaying-a-map-with-a-single-marker-for-a-content-template )


[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-field-slug'][/wpv-map-marker]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1374093

Thank you. I have replaced IDs with slugs.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.