Skip Navigation

[Resolved] How can I habe two maps on one page with different subselections

This support ticket is created 3 years, 4 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 7 replies, has 2 voices.

Last updated by Shane 3 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#2140227

Hi,

I have a CPT with a field set for addresses. In addition to an address field for map usage, I have a field "country". Now I want to have two or three maps on one page showing each just addresses from a certain country.

How/where can I put the different selections/conditions in place in order to do so?

hidden link

Thanks for any advice,
Martin

#2140329

Shane
Supporter

Languages: English (English )

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

Hi Martin,

Thank you for getting in touch.

If I understand correctly, you don't want all your posts being on one map, essentially you only want American posts being on the American map, Mexico posts being on the Mexico Map etc.

Are you using the Block method to setup your view or are you using the classic editor for your view because we will need to make use of the conditionals to target the different maps based on the country.

Please let me know.
Thanks,
Shane

#2140439

Hi Shane,

You got it right. And: so use the block method…

Kind regards, Martin

#2140513

Shane
Supporter

Languages: English (English )

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

Hi Martin,

The best way to do this is to add your multiple maps to the page. Each map will get a different map ID such as Map-1 or Map-2 etc.

Once you've done this then you need to add a conditional block in your view and set the conditional to check if the posts country. If the conditional matches country A then you will write the shortcode for the map marker which is like this below.

[wpv-map-marker map_id="my-map" marker_id="my-marker" marker_title="This is a marker" marker_field="wpcf-my-marker"]This is the content of the marker popup.[/wpv-map-marker]

So for this marker shortcode you will need to change "my-map" to the map ID it should target and "wpcf-my-marker" to the slug of the custom field that contains the address.

All that is needed is to use 2 or 3 conditional blocks to check the country and use the appropriate marker to target the appropriate map.

If this is not clear please let me know.
Thanks,
Shane

#2142453

Thanks so far. My main question now is “what kind of a block”’is it to put the conditional data in?

#2143841

Shane
Supporter

Languages: English (English )

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

Hi Martin,

You're referring to the marker shortcode correct. You can use the default wordpress shortcode block.

If you're having any issues with this please let me know.

Thanks,
Shane

#2144027

Hi, As I now try to follow the description I noticed that I do not know how to "add a conditional block in the view and set the conditional to check if the posts country matches "A". Then I shall - iIf the conditional matches country A – write the shortcode for the map marker (see above)...

Can you help how to write the conditional block in a shortcode block using block method? A few lines will help me to alter all the specific part myself...

Thanks, Martin

#2144051

Shane
Supporter

Languages: English (English )

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

Hi Martin,

We actually have some documentation at the link below that show provide some information on ow you can use the conditional block.
https://toolset.com/course-lesson/using-toolset-conditional-block/

If there are any issues or clarification needed I will be more than happy to assist.

Thanks,
Shane