Skip Navigation

[Resolved] Toolset Map

This support ticket is created 3 years, 3 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by Minesh 3 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2165675

Hello,

I am developing a site where I have created a cpt with coordinate fields and I wanted to know if I could display these entities with toolset map?

#2165817

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2021-09-10 at 16.37.20.png

You store the latitude and longitude in separate fields of your CPT posts?

You can display a map with a marker at these coordinates, but you will need to use the legacy shortcodes rather than the newer Blocks-based maps.

You insert a map with the wpv-map shortcode, and add a marker with the wpv-map-marker shortcode, and you will need to provide the values for the lat and lon attributes using shortcodes to get the values from your post fields.

To see what is required, I suggest you go to Toolset > Settings and specify that you use both the legacy and blocks-based editors, then say that new Content Templates should be created using the legacy editor.

Create a Content Template for your CPT (with the legacy editor).

Use the Fields and Views button to insert a wpv-map-render shortcode, and again to insert a wpv-map-marker shortcode. As you insert the marker, choose coordinates and add wpv-post-field shortcodes for the lat and lon as shown in the screenshot.

That should insert a shortcode something like:

[wpv-map-marker map_id='map-13' marker_id='marker-[wpv-post-id]' lat='[wpv-post-field name="wpcf-lat-field"]' lon='[wpv-post-field name="wpcf-lon-field"]'][/wpv-map-marker]

Note that in my example my coordinate custom fields have slugs of "lat-field" and "lon-field", and when output using the wpv-post-field shortcode you need to include their 'wpcf-' prefix. Edit these to match the slugs of your own custom fields.

https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-field

#2167677

And it's possible to display all cpt created ?

#2167775

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Do you mean you want to display all posts belongs to specific post type, if yes, yes, you can display all posts.

#2167885

Yes,
In fact I have a list of CPT entities with Lat and long custom field and I want to display them on a map
It's possibile ?

#2167889

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - you can display all entries for that you will require a view and within the view's loop editor you can add the map marker shortcode as described by Nigel and the map shortcode still stays outside the view's loop.