So right now I have the map markers being generated by some custom post types as well as a couple custom fields on each. Basically a list of employees assigned to each location. I have the listings being shown under the map, which is basically a list of employees. I’m wondering if there is a way to filter that list of employees under the map to only show the employees related to a location/marker that was clicked on the map?
I see it kind of working like this. You load the page and have a default set of employees loaded. Then you click on a certain location/marker on the map and the employees list changes to only show those from that location. The data is all there I just can’t seem to figure out how to do this. Each employee already has a marker category assigned on their post, along with all the location data to display on the map so it seems like this should be doable.
Thank you very much for contacting us. Yeah as you said above this is absolutely possible, You need to enable listings with a category filter on Listings settings under add/manage map.
When you filter the category, respective locations related to the category will display on the map. When you click on any marker, you are able to see employee list. It would be great if you share a page URL where the map is located so we can also check it at our end.
I have made a category for each location. I was previously entering each locations lat/long, address, etc. to every single post and then displaying those on the map. There was a lot of repetition that way. I'm now wondering a new approach. I was going to add a bunch of locations in the "manage locations" section. In there you can add a marker category as well. Then for each employee I can just check the marker category. However, when I display locations listing below the map I can't seem to show each employee that way? I was trying to add this code to the listing placeholder (which seemed to work when I was adding each location data directly to the employee):
I am sorry this is not possible --> "Since each employee is a post, I only see one spot in the post to add a location. Is there a way to add multiple?"
You have to insert the list of the employee in each post and assign the location using meta box. It indicated these employees are from that office location. This approach is suitable to you as per your need in your ist message.
It was suitable for me until I realized I needed an employee to be a part of multiple locations. That's why I was trying to find another solution. So there's nothing we can do here to have an employee (a post) related to multiple locations?
One thing you can do that, you can assign single posts to the maximum three locations.
#1 Location create using Google Metabox. ( https://wpgmp.flippercode.com/docs/how-to-display-posts-content-in-google-map/ )
#2 Location created by custom fields. ( https://wpgmp.flippercode.com/docs/how-to-show-posts-location-using-custom-fields/ )
#3 Location created by ACF ( https://wpgmp.flippercode.com/docs/how-to-assign-location-using-acf-plugin/ )
In a single posts you have to insert different locations details on each method. Only this is the way i think which is very useful for you. Using this method you can display your employee related to 2 office locations.
I hope it helps you.