This topic contains 7 reply and 2 voices, and was last updated by towhid 4 years, 3 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
June 16, 2015 at 8:14 pm 52186
towhid Hi, I tried this code
function gmw_update_location_via_wpuf(  $post_id ) {

	//make sure we have post ID
	if ( !$post_id )
		return;

	//change meta_field_name to the custom field of the address field
	$address = get_post_meta( $post_id, 'cf_address', true );

	//include geocoder file
	include_once( GMW_PT_PATH .'/includes/gmw-pt-update-location.php' );

	if ( function_exists( 'gmw_pt_update_location' ) ) {
		//setup geocoder args
		$args = array(
				'post_id'         => $post_id,
				'post_type'       => get_post_type( $post_id ), // change post_type to your own
				'post_title'      => get_the_title( $post_id ),
				'address'         => $address
		);
		//run geocoder function
		gmw_pt_update_location( $args );
	}
}
//update data of new post
add_action('wpuf_add_post_after_insert', 'gmw_update_location_via_wpuf', 10, 1 );
//update data when post updated
add_action('wpuf_add_post_after_updated', 'gmw_update_location_via_wpuf', 10, 1 );
Ater upgraded on pro version i modified add_action('wpuf_edit_post_after_update', 'gmw_update_location_via_wpuf', 10, 1 ); but it doesn't worked i don't have the custom posts types locations on the map. Thank you for help
June 17, 2015 at 10:11 am 52214
towhid towhid

Hello Frederick,

Where have you processed this code? In function.php?

Also please let me know what is the function of this code?

Thanks

June 17, 2015 at 11:43 am 52224
Frederick Frederick

Hi the aim of this code is to get meta of the address custom field for use by geo my wp plugin.
This plugin can display all my custom posts types on a map.

I tried to put it in functions.php and in a custom plugin but it doesn’t work since i’ve been upgrade to the pro version of wpuf

June 17, 2015 at 2:56 pm 52268
towhid towhid

Hello Frederick,

Please read the following documentation about the integration of WPUF with Geo Plugin.
http://docs.wedevs.com/wp-geo/

If you need any other assistance from me please let me know. I am here to help you.

Thanks

June 17, 2015 at 10:55 pm 52328
Frederick Frederick

Hi i tried with you code without succes because i don’t know how to set WPGEO data to gmw fields. The only way i know is to fill the address field.

This is my code :

function gmw_update_location_via_wpuf(  $post_id ) {

	//make sure we have post ID
	if ( !$post_id )
		return;
    
    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
        return;
    }

	//change meta_field_name to the custom field of the address field
	$address = get_post_meta( $post_id, 'adresse', true );
    
    if ( empty( $address ) )
            return;
    
	//include geocoder file
	include_once( GMW_PT_PATH .'/includes/gmw-pt-update-location.php' );

	if ( function_exists( 'gmw_pt_update_location' ) ) {
        
		//setup geocoder args
		$args = array(
				'post_id'         => $post_id,
				'post_title'      => get_the_title( $post_id ),
				'address'         => $address
		);
		//run geocoder function
		gmw_pt_update_location( $args );
	}
}
//update data of new post
add_action('wpuf_add_post_after_insert', 'gmw_update_location_via_wpuf', 10, 1 );
//update data when post updated
add_action( 'wpuf_edit_post_after_update', 'gmw_update_location_via_wpuf', 10, 1 );

Tha address field is correctly filled when post is created but not while updating.

Thank you for helping

June 18, 2015 at 4:33 pm 52385
towhid towhid

Hello Frederick,

I did not get you completely. Can you please provide me with screenshot also a proper description about the problem.

Thanks

June 22, 2015 at 10:21 am 52654
Frederick Frederick

Hi, thank you for you replies, the problem seems to come from gmw plugin. I installed the new beta version and the job is done better.

Thank you again

June 22, 2015 at 10:01 pm 52732
towhid towhid

Hello Frederick,

I am very happy to know that the you have solved the problem. I am going to mark this topic as resolved and closed.

Thanks

Viewing 7 Posts - 1 through 7 (of 7 total)