Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a website where the customer will enter their postal code and the pages (with a distance selected of 5, 10, 20 miles) will display on either a Google map or Bing map. The page results will display to the side of the map with a linkable Title and Address to visit the Page.

My thought is to add fields to the Page where the address and postal code can be entered. Then add a function on the Index that will pull the results from the Pages. The first piece is the customer will narrow their selection through Categories first. If this function would be easier to pull from Posts, I can change my route.

I actually had a dream of how this plugin could add tables to the sql but I've never made anything like this before... thoughts?

share|improve this question

1 Answer 1

There are a lot of pieces to this puzzle.

You need to be able to convert the postcodes into a numerical data format so you can query the pages/posts with "is greater than [current location minus 5 miles] and less than [current location plus 5 miles". In two dimensions. This means storing the latitude and longitude with the page. You can automate this, so that your custom postcode field updates custom lat and long fields on save, but obviously that's some custom code.

See: How can I implement a location based (zip code) search in WordPress?

There is some stuff on there about radiuses (because something both 5 miles north and 5 miles east is actually more than 5 miles away) but if you're going to show the results on a square Google map then you may as well include what's in the corners.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.