Forum: F.A.Q

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support and general questions related to GEO my WP plugin and its core add-ons please use the support forum.

Current Location Shortcode for only Latitude / Longitude Numeric Value

Forums F.A.Q Current Location Shortcode for only Latitude / Longitude Numeric Value

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #33014
    Ryan Dorn

    Hi there,

    First off, your plugin is amazing; we’re floored.

    We want to do some parametric filtering using ‘Toolset’ ( and, as such, need a way to insert only the numeric values of a current’ user’s location via shortcode. We intend to use the ‘native’ GMWP functionality (i.e. forms) to get the location, but once we have it, we need a way to output that value in a shortcode (raw, numeric value, no html).

    In other words, an ideal solution would be something a la:

    [custom_shortcode_current_lat] -> outputs raw value -> 40
    [custom_shortcode_current_lng] -> outputs raw value -> -73

    Thanks in advance and more than happy to clarify if needed!


    Thank you Ryan for the kind feedback.
    I am not completely understand what you are trying to achieve.

    Do you want to simply get the user current location and then display the coordinates somewhere on the page?

    Ryan Dorn

    Hi Eyal,

    Many thanks for your quick response. Happy to clarify and apologies for any confusion:

    We actually want to do more than just ‘display’ the user’s current location. We want to do custom radius targeting, and as such, need a way to parse out only the latitude longitude values.

    So, what we need to do is get the user’s current latitude / longitude (ideally via a custom shortcode).

    Does this clarify more? If not, could you please let me know what, specifically, is not making sense?

    Thanks in advance!

    Ryan Dorn

    Hi again Eyal,

    I took a look in some of GMWP’s shortcode php and came up with:

    So, with the following shortcodes we are able to produce just the lat/lng coordinate raw values”


    If, you know a better way of doing this, please let us know!


    Hey Ryan,
    Thank you for clarifying and thank you for posting the solution. Perhaps other users will find it useful.

    And indeed your solution is the best way to get the coordinates of the user’s current location, I don’t see any other/better way.

    Thank you


    Hello !

    I need something a little bit like this so maybe you can help me !

    I would like to get the long and lat of the user when visiting a page and save it in the database linked to his ID.

    Any idea how I can do that ?

    Thanks !


    Can someone help me how I implement Ryan’s solution? I added the code to the bottom of the gmw-current-location-shortcode.php file but adding the short codes to a page in my wp site doesn’t do anything.



    The code above will not work with GEO my WP 3.x. Below is the code that you need to use. And you need to add it to the functions.php file of your child theme ( or theme ).


    Have now resolved both issues. You are brilliant! Thanks a lot.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.