$post_type = $_POST['post_type']; $translations = $sitepress->get_element_translations($trid, 'post_' . $post_type); $results = array(); foreach ($translations as $language_code => $translation) { $post = get_post($translation->element_id); $title = $post->post_title ? $post->post_title : strip_shortcodes(wp_trim_words($post->post_content, 50)); $source_language_code = $translation->source_language_code; $results[] = (object) array('language' => $language_code, 'title' => $title, 'source_language' => $source_language_code); } echo json_encode($results); break; case 'get_orphan_posts': $trid = $_POST['trid']; $post_type = $_POST['post_type']; $source_language = $_POST['source_language']; $results = SitePress::get_orphan_translations($trid, $post_type, $source_language); echo json_encode($results); break; default: do_action('icl_ajx_custom_call', $request, $_REQUEST); } exit; /** * wpml_copy_from_original_fields * Gets the content of a post, its excerpt as well as its title and returns it as an array * * @param * * @return array containing all the fields information */ function wpml_copy_from_original_fields()
> <?php echo $lang['display_name']; ?> </option> <?php } ?> </select> <input type="hidden" name="icl_trid" value="<?php echo $trid; ?> " /> </div> <?php if (isset($translations) && count($translations) == 1 && count(SitePress::get_orphan_translations($trid, $post->post_type, $this->get_current_language())) > 0) { $language_name = $this->get_display_language_name($selected_language, $this->get_default_language()); ?> <div id="icl_document_connect_translations_dropdown" class="icl_box_paragraph"> <p> <a class="js-set-post-as-source" href="#"> <?php _e('Connect with translations', 'sitepress'); ?> </a> </p> <input type="hidden" id="icl_connect_translations_post_id" name="icl_connect_translations_post_id" value="<?php echo $post->ID; ?> "/> <input type="hidden" id="icl_connect_translations_trid" name="icl_connect_translations_trid" value="<?php