NOTE: I’m not giving a full answer to your question but trying to give some snippets that may help in WPML-based project.
I’ve used this function:
function get_the_translated_ID($id){
if (!class_exists('sitepress')
return $id;
global $sitepress;
$type=get_post_type($id);
return icl_object_id( $id, $type, false, $sitepress->get_default_language());
}
This allows, for example, to search for custom_meta values of the original post instead of the translations.
Example in a loop:
$color = get_post_meta( get_the_translated_ID(get_the_ID() ), 'room_color',true);
Another useful one is to update some custom meta (the ones which has to be considered independent from language) in all the translations when updating a post in one lang:
function bulk_CF_update($post_id){
if (!class_exists('sitepress')
return;
$thisPost=get_post($post_id);
$allmeta=get_post_meta($post_id); // grab all custom meta fields of the post
$toUnset = array("CF_1","CF_2","CF_3"); // exclude the CF you want to keep 'per-language'
foreach($toUnset as $unset)
unset($allmeta[$unset]);
if($thisPost->post_type=="roomtype"){ // do it only for one or more specific cpt
$trid = $sitepress->get_element_trid($thisPost->ID,'post_roomtype'); //note the prefix 'post_' has to be added to your cpt slug
$translations = $sitepress->get_element_translations($trid);
foreach($translations as $translation){
foreach($allmeta as $meta=>$val){
if(count($val)==1) //we're only managing single values
update_post_meta($translation->element_id, $meta, $val[0]);
}
}
}
}
add_action( 'save_post', 'bulk_CF_update',10,1);
Hope it may help