/** * Builds translations from given post. * * @param $post * @param $mlp_post_id * * @return array */ public function build_translation_item($post, $mlp_post_id) { $ret = array(); $source_id = Wpml2mlp_Helper::get_default_post_ID($post); $source_post = get_post($source_id); if ($source_post == NULL) { return FALSE; } // put translations here for current post array_push($ret, new Wpml2mlp_Translation_Item($source_post->post_title, $post->post_title, $source_id, $mlp_post_id)); array_push($ret, new Wpml2mlp_Translation_Item($source_post->post_content, $post->post_content, $source_id, $mlp_post_id)); return $ret; }
/** * Gets the relevant multisite post id from singlesite post. * * @param $post * @param $blog * * @return int */ public function get_multisite_id($post, $blog) { $rel = $this->content_relations->get_relations(Wpml2mlp_Helper::get_default_blog(), Wpml2mlp_Helper::get_default_post_ID($post), $post->post_type); $blog_id = (int) $blog['blog_id']; $multisite_id = -1; foreach ($rel as $key => $value) { if ($key == $blog_id) { $multisite_id = $value; break; } } return $multisite_id; }