Skip Navigation

[Closed] Displaying a custom field as a map marker

This support ticket is created 4 years, 6 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 4 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1626551
Compare hotels - Best prices guaranteed for luxury- boutique and budget hotel rooms – momondo 5-15-2020 6-50-38 PM.png

Tell us what you are trying to do?

I know this is a feature that's available with the google maps api, but curious how I can implement using the text of a custom field to display instead just a simple map marker. For example, I've provided an image from a website where the price of the listing is displayed as the map marker and I would like to achieve something similar.

Thanks!

#1628105

I know this is a feature that's available with the google maps api, but curious how I can implement using the text of a custom field to display instead just a simple map marker.
You can use a custom image as the map marker's background, but there's not a built-in way to display dynamic text on the marker itself. Like standard markers on Google Maps, Toolset's markers are designed to display information in a standard popup/InfoWindow after a click event.

We have documentation available for customizing the marker image / icon: https://toolset.com/documentation/user-guides/maps/display-on-google-maps/displaying-markers-on-google-maps/#marker-icon
...and documentation for more options for the marker shortcode:
https://toolset.com/documentation/user-guides/maps/maps-shortcodes/#wpv-map-marker
You can see there is a title option, but that doesn't appear until you hover your mouse over the marker or one of the "focus on marker" links, if you set it up as such.

If you want to try manipulating map markers using the Google Maps JS API, you can see an example showing how to access a Map object here:
https://toolset.com/documentation/user-guides/maps/programmatically-change-map-settings/

I added a small change to the example code showing how to access an array of Marker objects:

// Listen to js_event_wpv_addon_maps_init_map_completed
$( document ).on('js_event_wpv_addon_maps_init_map_completed', function( event, event_settings ) {
    var markers = WPViews.view_addon_maps.markers;
    // Now you have access to a multidimensional array of Marker objects in the variable "markers". 
} );

Here is a link to some documentation for the Google Maps JS API for drawing on the map:
https://developers.google.com/maps/documentation/javascript/overlays

That's about all I can offer, since this is custom code that falls outside the realm of our support forums. Let me know if you have questions about that.

The topic ‘[Closed] Displaying a custom field as a map marker’ is closed to new replies.