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

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

This topic contains 8 replies, has 4 voices, and was last updated by  cartti 1 year, 1 month ago.

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

    Ryan Dorn
    Participant

    Hi there,

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

    We want to do some parametric filtering using ‘Toolset’ (http://wp-types.com/) 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!

    #33018

    Eyal Fitoussi
    Keymaster

    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?

    #33017

    Ryan Dorn
    Participant

    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!

    #33016

    Ryan Dorn
    Participant

    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”

    [gmw_current_lat]
    [gmw_current_lng]

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

    #33015

    Eyal Fitoussi
    Keymaster

    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

    #51386

    Website Ladies
    Participant

    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 !

    #58149

    cartti
    Participant

    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.

    #58170

    Eyal Fitoussi
    Keymaster

    @cartti,

    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 ).

    #58175

    cartti
    Participant

    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.