Skip Navigation

[Resolved] map marker e field text

This support ticket is created 4 years, 11 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by federicoA 4 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#1245168

hi, need some info.
1. I have a map with many markers and clusters. Is it possible to make the map position itself at the center of all the markers?
2. I have a field that contains emails separated by commas (info@youtdoman.com, info2@youtdoman.com, etc ...). it is possible to format the output so that it recognizes the email and inserts the link on each email (<a href="mailto:info@youtdoman.com"> info@youtdoman.com </a>, etc. .... ??
thanks

#1245303

In answer to your questions:

1. Yes, when you insert a Map you have an option to choose "Adjust zoom and center to show all markers at once", in the toolbar to the right of the Post Editor, when using Gutenberg. That'll center the map in the middle of all markers, in other words.
Also when inserting the Map with a ShortCode, you can opt for "Adjust automatically to show all markers at once". This has the same effect as above described.

2. If the same field holds all those emails comma-separated, then no, because Toolset provides ShortCodes that display their content - it cannot split the content up to arrays and output for each a certain appendix.

For this, either you'd need a Repeating Field (single line) where each instance is an email, and then output that, for example with a Custom HTML separator using the Toolset ShortCode for Repeating Custom Fields. An example further below.

Otherwise, you'd need to create a custom code snippet which takes as input the value of that field (for example with get_post_meta()), then splits it for example into an array of emails (for example with explode()), wraps all instances into the desired HTML and finally returns the new (wrapped) emails to be returned (for example) in a ShortCode.
Similarly, you could probably alter the output of the Custom Field with JS, inserting an HTML element at each ",".
However, such customizations fall under Custom Code, which we can assist only limitedly here (see https://toolset.com/toolset-support-policy/)

Example of Repeating Field output with Custom HTML separator, which then generates a list of Emails wrapped in the desired HTML:
1. Create an email field or single line field, choose "Allow multiple-instances of this field"
2. Populate the several instances of the field with the email addresses
3. Output the Field using the Toolset GUI "Views and Fields" and after clicking "your_custom_field" edit the "Separator between multiple values", inserting a valid HTML sequence.
Pay attention, that this is a separator, hence, it'll occur only within the single values. Not at its start, not at its end.
Hence, after inserting the valid HTML you'll need to wrap that ShortCode within valid opening and closing HTML tags:

<li>
[types field='address' separator='</li><li>'][/types]
</li>

As you see, I first close, then open the list. That's because those are separators and occur only within the values.
It'll output a list of repeating field items, instead of comma separated as by default.

Similarly, you can wrap any other kind of HTML around those values if the Field is a Repeating Field.

#1245724
Schermata 2019-05-20 alle 10.31.58.png

for the answer 1.
i'm set shotcode:
[wpv-map-render map_id = "map-4" map_height = "550px" fitbounds = "on" general_zoom = "9" cluster = "on"] [/ wpv-map-render]

now the map is centered but I can't set the zoom.
as you can see from the first image the zoom is set to 0. then I can click on the cluster and see the detail correctly.
why?
thanks

#1246340

You will need to insert the Map and Markers with the GUI.
Then the shortcode produced should also produce a working front end map, as I tested this locally it did.

Note also that there are 2 settings for the zoom level when centring, one for when there are only one marker and the other for many markers:
Use this zoom level when there is more than one marker
Use this zoom level when there is only one marker

Those work fine on my local.

Maybe you'll need to make a test with a freshly generated ShortCode using the GUI and also try without any other Plugin but Toolset and eventually another Theme.
It might be that some software conflicts.

If all this doesn's solve the issue, I would have to see this on a local copy - which you can then provide me using this information https://toolset.com/faq/provide-supporters-copy-site/

#1248123

My issue is resolved now. Thank you!

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