I'll do this in dot points to make life easier on all you helpful people!
- I am making a WP Query through a custom post type ("location").
- One of the custom_fields for location is "postcode".
- I need to grab this postcode and run it through a function which works out the distance between that postcode and where the user is; using another SQL database of postcode distances
- I then want the result to be the sorting factor of this WP_Query so that I can cycle through all of them in order of distance apart
- I also want to limit the results to a particular distance away (e.g. Only show those less than 100km in that PHP function).
I have the query made and it can go through ALL of the locations perfectly, and the postcode custom_field returns great, but I can't work out how to use it in the original query!
Thanks very much for the help!