Skip Navigation

[Resolved] Having a list view and map view controlled by same filter

This support ticket is created 2 years, 2 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Timothy 2 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#2451347

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

#2451447

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

#2451555

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

#2452119

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.

#2455529
exclude-from-map-field.png

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.

#2455997

My issue is resolved now. Thank you!