I used the Toolset Maps to create a map from a custom CPT. I got the map to display, but I would like the title and address from my CPT to display when I hover the mouse over the marker. Can this be done with Toolset Maps?
Hi,
Thank you for contacting us and I'd be happy to assist.
Yes, you can set the content for the map marker's hover and the pop-up event. You'll find these options in the map block's settings, as shown in the attached screenshot.
( ref: https://toolset.com/lesson-placement/lesson-placements-1622939-1620853/#add-marker-pop-up-content-and-hover-hints )
In these fields, you can use the Toolset shortcodes to show the content like the post title and the custom field data:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/
https://toolset.com/documentation/customizing-sites-using-php/functions/
Note: If you're using the map shortcodes for the map and the marker, you can use the 'marker_title' attribute in the map marker's shortcode, to show the content for the hover event:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/
Example:
[wpv-map-render map_id="map-1"][/wpv-map-render]
[wpv-map-marker map_id='map-1' marker_id='marker-1' marker_title='hover event content' marker_field='wpcf-address-field']Popup content[/wpv-map-marker]
I hope this helps and please let me know if you need further assistance.
regards,
Waqar
Sorry, but I must be confused as my screen does not look like that at all. Attached is what my screen shows and the map only displays the CPT title. I want the title and the address field.
Thanks for writing back.
In the screenshot you've shared, the 'wpv-map-marker' shortcode can be seen that is being used to generate the map markers.
( screenshot: hidden link )
As shared in the example of that shortcode in my last reply, you can include the 'marker_title' attribute, to show any content in the mouse hover state of the marker:
[wpv-map-marker map_id='map-1' marker_id='marker-1' marker_title='hover event content' marker_field='wpcf-address-field']Popup content[/wpv-map-marker]
I see that, but I do not understand how to get the CPT content to display within the marker_title. I have tried using shortcodes to no avail. What I want it the title of the CPT along with the address field. Please advise.
To troubleshoot, why it didn't work, I'll need access to the website's admin area.
Can you please share temporary admin login details, along with the link to the page with this view?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
Thank you for sharing the access details.
I've updated the map marker shortcode so that the post title ( [wpv-post-title] ) and the address field ( [types field="retail-address"][/types] ) are passed to the marker through the 'marker_title' attribute:
( screenshot: hidden link )
[wpv-map-marker map_id='map-23' marker_id='marker-[wpv-post-id]' marker_field='wpcf-retail-address' marker_title='[wpv-post-title] - [types field="retail-address"][/types]'][/wpv-map-marker]
You'll now see the post title and the address while hovering over the map markers.
My issue is resolved now. Thank you!