Support » Plugin: DistanceFromMe » [Plugin: DistanceFromMe] Alternate use

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author rdconnell


    Hi, Sounds like a good idea. I had a quick look and it looks possible to do. Looks like I need to add a couple of custom fields to hold the lat/lng and then display the ‘your are xx from this post’ text on post the users can see.

    I will give it a go and see what I can do.

    Thanks for the feedback and apologies for the delay in replying, I was on holiday and didn’t see your comment until today.



    No apologies! I just had stored the lat long as custom fields and saw this and it seemed a stones throw away. I am working on it now, but using the actual mathematical difference between the numbers to find the distance, as mine are all very local in one small region, we’ll see how it goes (having trouble with getting user locations consistently) would love to see what you come up with!

    Plugin Author rdconnell


    I had a play about and got something working using a geolocation plugin to store the lat/lng in the post and then distancefromme to extract the values and display the distance in a post. There are a couple of minor niggles with the geolocation plugin, for example it doesn’t seem to store/display the address text correctly, but it has a nice UI to enter the location details and saved me doing it for now 🙂

    The plugin creates a space in the post for the text to go and then calls the javascript function to populate it with the correct details. Hopefully you should be able to change the code to use your own custom fields instead if thats more useful.

    The rest of the code is pretty much the same as before as all I did was add the shortcode details to the .php file and modified the distance function in the .js file to accept a source for writing the results back to.

    I noticed the same issue as yourself with the user locations being a bit inconsistent but it generally gives the correct location after the user refreshes the page once. Not the ideal solution but I couldn’t find anything better and since this was just for fun I didn’t look too hard.

    Hopefully this is useful in what your trying to do as well. If nothing else it was a good idea and I learned some new stuff while doing it so definitely worthwhile 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: DistanceFromMe] Alternate use’ is closed to new replies.