Skip Navigation

[Resolved] Map marker description and links

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
- 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 replies, has 2 voices.

Last updated by Waqar 1 year, 10 months ago.

Assisted by: Waqar.

Author
Posts
#2520669

Hello,

How do we get the map markers to show the title and link, like the example here: hidden link

And is it possible when you click on a thumbnail post listing it highlights which marker it is on the map?
hidden link

Thanks

#2520685

I found the hint content so it's now showing the title and link, I wasn't able to add code to make it open in a new window, is that possible?

#2521675

Hi,

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

Glad that you were able to add the content to the map marker's info window/pop-up.

If you're using the shortcode 'wpv-post-link' to show the post title link, it doesn't have the option to open it in the new window. To make this work, you can create the link using the "wpv-post-url" and the "wpv-post-title" shortcodes that also include the attribute target="_blank", like this:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/ )


<a href="[wpv-post-url]" target="_blank">[wpv-post-title]</a>

To add a link in the view's result to focus on the relevant marker on the map, there is a feature to use a specific class name and data attributes to specify the target map and map marker's information, as explained here:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#map-focus-on-marker

However, using this in the blocks-based view is a little tricky, as we don't have control over setting the map marker's ID. To make this work, you'll first have to make sure that the map block is NOT set to show the map markers, and they are set through the map marker shortcode "wpv-map-marker":
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

For example, suppose that:

- the map ID in the map block is set to 'map-1'
- the slug of the location field is 'property-location'

The code for the map marker and the focus on the map marker link, will look like this:


// code for the map marker
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-property-location']<a href="[wpv-post-url]" target="_blank">[wpv-post-title]</a>[/wpv-map-marker]


// code for the map marker focus link
<a href="#" class="js-wpv-addon-maps-focus-map js-toolset-maps-open-infowindow-map-map-1-marker-marker-[wpv-post-id]" data-map="map-1" data-marker="marker-[wpv-post-id]">Show on map</a>

Note: You can include a "Fields and Text" block in the loop of the view and include this code in that.

Important note: Your view's results are set to show the outer container block as a link. As nesting of links (anchor tags) is not supported/allowed in HTML, to include any links inside that container block, you'll have to disable this option of using the container as a link.

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

regards,
Waqar