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?
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.
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
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...