Skip to content
Advertisement

How to integrate WordPress search with Google maps?

I am doing a beauty salons website for my client using WordPress. I have created custom post type for beauty salons.

Now I need to create a page where user can enter a place for example a city and select number of results or a radius in terms of Kilometers.

Once we have the results we need to show all results on a map. We also have a filters to filter the search using some of meta keys.

I am not good at javascript and/or Google Map API v 3. How to do above? I do not need full code I just need guidelines. or is there some plugin which do the same?

Advertisement

Answer

You would need all your coords in the db to locate which locations to map

Then you can search for all locations between +/- x kilometers north / south and +/- x kilometers east / west

If you then want to find the closest you can use Pythagoras theorum to find out the distance to each point

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement