I am building a medical volunteers' website which uses the Nine To Five WP theme which acts as a jobs manager. The theme allows Wordpress to act as an employment website.
Jobs are saved as posts, and when a job is created (from the front end), the job's location can be entered. The location is entered in text form just like a postal address, rather than in geographical coordinates. This location is saved in a "location_value" field in the post's meta information.
Can I adapt Geo Mashup to use this existing location information?
I know there is the [[LINK href="http://wordpress-geo-mashup.googlecode.com/issues/attachment?aid=6606682652485570261&name=geo-mashup-custom-fields.zip&token=cllUiR_9wePDYpKnIHcT4VJSVPs%3A1326027492348"]]Geo Mashup Custom Fields[[/LINK]] plugin, but this only works when creating posts from the back end, and not from custom theme pages in the front end.
Julio Potier answers:
Hello
Look at this question : [[LINK href="http://wpquestions.com/question/showLoggedIn/id/3634"]]http://wpquestions.com/question/showLoggedIn/id/3634[[/LINK]]
See you
Dylan Kuhn answers:
Julio is right, but the quick version is that you should be able to enter location_value in the "Geocode custom field" Geo Mashup setting, after which saving a custom field with that key should trigger Geo Mashup to geocode the field and save a location if geocoding succeeds.
SRD comments:
I've tried this, but this is only triggered when creating a post in the <strong>back end</strong>.
It is not triggered when creating a post from the <strong>front end</strong>.
The Geo Mashup Custom Fields plugin probably connects to the specific back end file to create posts.
I need a way to connect it to a specific, custom, front end file (from the theme).
[[LINK href="http://www.doig.com.au/test/volunteer/"]]Website in question[[/LINK]].
[[LINK href="http://www.doig.com.au/test/volunteer/post-a-job/"]]Page in question[[/LINK]].
Dylan Kuhn comments:
As of Geo Mashup 1.4 custom field handling is built in, so you shouldn't need the old Geo Mashup Custom Fields plugin. I don't think that's the issue, but you can safely git rid of it.
Geo Mashup uses WordPress hooks to detect when a custom field is saved, which should be independent of how the post is created. All I can think is that the nine-to-five theme is not using the WordPress API to save the custom field, or it is somehow preventing other plugins from loading when it does that.
SRD comments:
Can you think of a way to test if Nine To Five is using the API properly when saving a post?
Can I insert some code to display a message if the API is used?
Dylan Kuhn comments:
A test would look similar to the code Geo Mashup uses. If Nine To Five is using AJAX, you'd have to use a debugger like Firebug to look for the message in the response to the ajax request.
function my_post_meta_update_test( $meta_id, $post_id, $meta_key, $meta_value ) {
echo 'WP API used to update meta key ' . $meta_key . ' for post ' .
$post_id . ' with value . ' $meta_value;
}
add_action( 'added_post_meta', 'my_post_meta_update_test', 10, 4 );
add_action( 'added_postmeta', 'my_post_meta_update_test', 10, 4 );
add_action( 'updated_post_meta', 'my_post_meta_update_test', 10, 4 );
add_action( 'updated_postmeta', 'my_post_meta_update_test', 10, 4 );
SRD comments:
I added this code to the theme's functions.php file (correct?), and I did receive a confirmation:
<blockquote>WP API used to update meta key _encloseme for post 121 with value 1
WP API used to update meta key position_type_value for post 121 with value filter_2...</blockquote>
Dylan Kuhn comments:
Can you paste the confirmation message for the location_value field?
SRD comments:
<blockquote>WP API used to update meta key location_value for post 123 with value Meekatharra, Western Australia</blockquote>
Dylan Kuhn comments:
Seems like that should work. Would you be willing to send me a private message with a temporary admin and FTP login so I can troubleshoot?