Skip Navigation

[Resolved] One map with 2 post types

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

Problem:

The issue here is that the user wanted to display 2 post types on a map with different markers.

Solution:

Yes this is possible, however I would recommend using 2 separate views. So what you would do is to place the Map on the page content template.

Then you will use the 2 separate views to provide the marker information. Now as long as the Markers are targeting the same Map id then they will be displayed on the map.

From there you can specify which type of marker to be used for each Post Type.

This support ticket is created 5 years, 9 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 8 replies, has 2 voices.

Last updated by winyS 5 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1220421

I have Members and Observers (2 custom post types) and I want to show both Members and Observers on one map, with a different marker color.
Is that possible?

#1220453

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Winy,

Thank you for contacting our support forum.

Yes this is possible, however I would recommend using 2 separate views. So what you would do is to place the Map on the page content template.

Then you will use the 2 separate views to provide the marker information. Now as long as the Markers are targeting the same Map id then they will be displayed on the map.

From there you can specify which type of marker to be used for each Post Type.

Thanks,
Shane

#1220905

Hi Shane,
Thanks for your answer.
I created 2 views.

View 1: Observers on map:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
[wpv-post-body view_template="loop-item-in-observers-on-map"]
<wpv-loop>
[wpv-map-marker map_id='map-members-observers' marker_id='marker-1' marker_icon='hidden link' marker_title="Name: [wpv-post-title]" marker_field='wpcf-google_address']<h3>[wpv-post-title]</h3>
<p class="address">[types field='address-line-1'][/types]<br>
[types field="address-line-2"][/types]</p>
<p class="city">[types field="city"][/types]</p>
<p class="country">[types field="country"][/types]</p>
<p class="website">Website</p>
[/wpv-map-marker]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

View 2: Members on map:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
[wpv-post-body view_template="loop-item-in-map-with-address"]
<wpv-loop>
[wpv-map-marker map_id='map-members-observers' marker_id='marker-2' marker_title="Name: [wpv-post-title]" marker_icon='hidden link' marker_field='wpcf-google_address']<h3>[wpv-post-title]</h3>
<p class="address">[types field='address-line-1']<br>
[types field="address-line-2"][/types]</p>
<p class="city">[types field="city"][/types]</p>
<p class="country">[types field="country"][/types]</p>
<p class="website">Website</p>
[/wpv-map-marker]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Template for both views: "loop-item-in-map-with-address":
[wpv-map-render map_id="map-members-observers"][/wpv-map-render]

I created a test page with 2 views shortcodes:
[wpv-view name="members-on-map"]
[wpv-view name="observers-on-map"]

Is this what you meant?

#1220971

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Winy,

Yes this is what I meant.

I checked and saw that there are 2 different markers displaying as you want it.

Is there any issues with this or is everything displaying correctly.

Please let me know.
Thanks,
Shane

#1223065

Hi Shane,
My issue is resolved.
Everything is displaying correctly.
Can you please remove the link in my message above?
Thanks for your help.

#1223076

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Winy,

Happy I was able to assist. I've removed the reference to your site from the forum.

Thanks,
Shane

#1245983

Hi,
This worked fine for some time. But now the map seems to be missing. Instead of the map I see a white space. In the html I see the views code. Can you see what's wrong here?
URL: hidden link
Thanks,
Winy

#1245996

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Winy,

THis seems to be a different issue from the original one of the thread.

Our procedures require a new ticket per issue.

What I would recommend is that you mark this one as resolved and then open a new ticket for this issue and assign it to me.

Thanks,
Shane

#1250169

I opened a new ticket for this issue.