Skip Navigation

[Gelöst] Map marker description and links

This support ticket is created vor 1 Jahr, 11 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Waqar vor 1 Jahr, 11 Monaten.

Assistiert von: Waqar.

Author
Artikel
#2520669

Hello,

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

And is it possible when you click on a thumbnail post listing it highlights which marker it is on the map?
versteckter 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