Problem: I have a map that displays markers from a View that displays results from two different custom post types. I would like to be able to always display all results from custom post type A, but allow the User to apply front-end filters to filter custom post type B.
Solution:
This is possible using two separate Views, with some limitations.
- Since you already have one View set up with custom search filters, you should uncheck the Content Selection checkbox for the Monuments post type in this View. This View should only include Restaurant posts in the Content Selection.
- Create a separate View that shows all Monument posts. Insert map marker shortcodes in this View, but do not insert another map shortcode. Set the map_id attribute in these marker shortcodes to point to the same map_id from the original view.
- Insert the Monuments View in the same template or post as the original Restaurants View.
- I see a Distance filter at the top of the page. If you plan to filter both Monuments and Results using the same Distance filter, you must apply an identical Distance Query Filter in the Monuments View as well. You can hide the duplicate front-end distance filter in this View by commenting out the wpv-filter-meta-html shortcode in the Output Editor of the Monuments View.
- AJAX updates are not be fully supported when two separate Views are used on the same page. A submit button with page refresh is required to load both sets of results on the same map.
Relevant Documentation:
https://toolset.com/course-lesson/displaying-a-list-of-posts-on-a-map/
https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 4 replies, has 2 voices.
Last updated by David Gimenez 3 years, 5 months ago.
Assisted by: Christian Cox.