本文整理汇总了PHP中SitePress::get_orphan_translations方法的典型用法代码示例。如果您正苦于以下问题:PHP SitePress::get_orphan_translations方法的具体用法?PHP SitePress::get_orphan_translations怎么用?PHP SitePress::get_orphan_translations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SitePress
的用法示例。
在下文中一共展示了SitePress::get_orphan_translations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$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()
示例2:
>
<?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