Skip Navigation

[Resolved] Display two markers from one post in a map

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display two markers on a single map. The locations for each marker are stored in separate custom fields on the same post.

Solution: Use one map shortcode and two marker shortcodes to display the map on your custom post template. No View is required here, since you don't need to loop over posts.

Relevant Documentation:
https://toolset.com/documentation/user-guides/display-on-google-maps/

This support ticket is created 5 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by yvonneJ 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1371357

I have a CPT where people can enter up to 2 locations for their office addresses.
Visiters can filter businesspersosn by category and can see all the locations. Not problem so far.

Bu on a single CPT I would like both locations of the specific post to be shown in a small Google Maps. I tried it with a View, but I cant find the right things to do.

I have read online documentation and asked for help from collegues, no success so far.

Can you help me with this topic?

#1371469

Hi, how are the two locations stored in your custom post type - are they separate custom fields, or is it one repeating custom field, or are they in a repeatable field group?

Also, do you want the maps to be interactive, so the site visitor can zoom in, pan around, and click the marker in the maps, or do you want simple map images that are not interactive?

#1371595

Hi Christian,
Thanks for your time.
They are two seperate custom fields (repeating option was not possible with the first Google Maps adress field).

The two fields dont have to be interactive; just displaying in the same map together. Zoom option would be nice. You can see the bigger map with filer here: hidden link You can see a single post here: hidden link
Sometimes a second adres is used, sometimes just one. When someone hs two adresses I would like to show them together in a map on a single post.

Please tell me if you need more information.

#1371707

Okay I don't think you need a View here. You can use a map shortcode and two marker shortcodes in your single post Content Template. Place your cursor in the Content Template, then click "Fields and Views" to show the popup. Click "map" here to insert a map. Make sure to use a unique map ID. When you finish, the system will generate the map shortcode for you.
Then click Fields and Views again, and this time click "marker". In the configurations, set the map ID you just created, then choose the custom field as the source of the marker. When you finish, the system will generate the map marker shortcode for you.
Then click Fields and Views again, and repeat the marker process for the second custom field.

Let me know if you have trouble implementing this map.

#1372111

My issue is resolved now. Thank you!