WordPress.org

Ready to get started?Download WordPress

Forums

WP Geo
[resolved] Extrapolate coordinates (2 posts)

  1. Stu
    Member
    Posted 1 year ago #

    I'm using WP Geo plugin in conjunction with the Geo Mashup plugin. On a form I have used an identifier (geocodedtc) for a post custom field in the Geo Mashup plugin. Using gravity forms I have created a post form that passes simply a City name to the custom field. Geo Mashup recognizes this and inserts the pin automatically on my global map and links directly to the post. All geo data on that city for lat/long, district, state etc is shown on the map below the post edit screen just below the WP Geo map. To activate the WP Geo map on a post I now have to simply copy the lat/long into the search box of the WP Geo interface and the post is then populated with it's own specific map. It would be great if this could be automated yet I understand if a user passed the lat/long into the template WP Geo would pick that up, but it's asking a lot for a lay user to figure that out.

    Looking forward to any ideas about this need.

    Thanks,
    Stu

    http://wordpress.org/extend/plugins/wp-geo/

  2. Ben Huson
    Member
    Plugin Author

    Posted 1 year ago #

    In order to pre-populate WP Geo, you would need to save the following 2 custom meta values for the post.

    _wp_geo_latitude
    _wp_geo_longitude

    You can save these values using the update_post_meta() function.

    I think the best way to do this would be use a updated_post_meta hook to update WP Geo meta whenever your custom field data is updated. Something along the lines of:

    add_action( 'updated_post_meta', 'my_after_post_meta', 10, 4 );
    function my_after_post_meta( $meta_id, $post_id, $meta_key, $meta_value )
    {
        if ( 'geocodedtc' == $meta_key ) {
            // Update WP Geo values here based on geocodedtc value $meta_value
        }
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.