Hello,
I have a view listing my custom posts, with filters. And another map view showing the listings on a map. How can I have the filters control both the list and the map at the same time?
hidden link (map is at the bottom)
Thanks,
Tim
Hi Tim,
Thank you for contacting us and I'd be happy to assist.
Is there any specific reason, for using two separate views for showing the list of posts and the map?
If you could place the map's shortcode, in your first view (that is showing the list of posts), it will update automatically when the search filters will be used. And you won't need a separate view for the map too.
Note: You can place the map marker shortcode "wpv-map-marker" ( ref: https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker ) in the loop of the first view and the map shortcode "wpv-map-render" ( ref: https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render ) at the bottom of its "Output Editor" section.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
I've done what you suggested and put them both into one View.
hidden link
But the purpose of creating separate views for the list of posts and the map was because I wanted to exclude a few outliers just from the map which I was doing with the Query Filter. But maybe there is another way to do that?
Tim
Thanks for writing back.
Yes, it is possible to exclude certain posts from the map, while using the same view for the posts lists and the map.
Can you please share temporary admin login details, along with the list of the posts that you'd like to be excluded from the map?
I'll be in a better position to suggest the next steps, accordingly.
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
Thank you for sharing the admin access details.
To exclude certain posts from the map, you can add a new checkbox type custom field "Exclude from Map", to your post type.
( example screenshot attached )
After that, you can wrap your view's map marker shortcode, in a conditional statement, so that it is only included for the posts where the value of this new custom field is not equal to '1' (i.e. the checkbox to exclude from the map is not checked)
( ref: https://toolset.com/documentation/legacy-features/views-plugin/conditional-html-output-in-views/ )
Example:
[wpv-conditional if="( $(wpcf-exclude-from-map) ne '1')"]
[wpv-map-marker map_id='map-2' marker_id='marker-[wpv-post-id]' marker_title='[wpv-post-title]' marker_field='wpcf-place-address']
[/wpv-conditional]
I hope this helps and please let me know if you need any further assistance around this.
My issue is resolved now. Thank you!