• Resolved neolitemajesty

    (@neolitemajesty)


    Nevermind, I found the answer myself. I’m just gonna leave this here in case someone else finds it useful, or you might have a better suggestion on how to do this?

    I have a form on one page for creating new custom posts and I want to write location to that newly created post at the same time.
    I guess this plugin wasn’t made for such thing. As I’ve seen that kind of thing was meant to be possible only from WordPress dashboard, because all of the functionality that is available on WordPress pages is through shortcodes and post meta data.
    So, I had to write location data for a post directly in a database(save_data function from plugins/posts/includes/admin/gmw-pt-metaboxes.php) and using do_shortcode(‘[gmw_current_location display_by=”street,city,country,lat,lng”]’) to get info about current location and then parse it.

Viewing 1 replies (of 1 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    HI,
    Thank you for posting your solution.

    You are correct. GEO my WP does not have a front-end post creator for the main reason that there are many plugins out there that does so. However, GEO my WP already comes with a function which can easily add a location to post when posting from the from-end.

    the function is

    gmw_pt_update_location( $args );

    and it can be found in geo-my-wp/plugins/posts/include/gmw-pt-update-location.php.

    The function takes the address field entered in the form, geocode it and save the necessary fields in database.

    you can look at the file to learn about the $args you need to pass into the function. Also, you will need to include the file before running the function.

    Hope it helps

Viewing 1 replies (of 1 total)

The topic ‘sticking location data to posts from custom script’ is closed to new replies.