Now that Loopers are back in the focus, I thought I could mention another common requirement, when it comes to location listing websites.
We already have a great Map element. It displays a single location and it works great. With some extra code, we can split lat
and lng
from the ACF Map field, and use it as a source for the map element. It would be great if we could have native custom meta fields for lat
and lng
, separately extracted from the ACF map field, but that is not the topic now.
The true power would be if we could feed a post type to the Map element. It could read either a single comma-separated lat, long
custom field, or it could use the ACF Google Map field as a data source. Or it could read two separate fields for latitude and longitude.
Here’s how the FacetWP Map facet is working. That’s exactly how the Map looper could work.
When a single comma-separated field is used, or when ACF Google Map field is used, then there is no need for the Longitude field. If, however the user wants to provide two separated fields for lat
and lng
, then the optional longitude data source can be entered.
The result would be a map displaying all the locations from the looped post type. We could then filter them further based on listing categories, etc. Of course, we could also utilize fully customizable Map markers containing dynamic data. It would be great if Markers could accept Pro elements and if the marker icons could be changed.
In essence, Pro would then be fully equipped to build listing websites, without the need for external listing plugins.