當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SitePress::get_orphan_translations方法代碼示例

本文整理匯總了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()
開發者ID:PHQ-Design,項目名稱:souza-lima,代碼行數:31,代碼來源:ajax.php

示例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 
開發者ID:edgarter,項目名稱:wecare,代碼行數:31,代碼來源:post-menu.php


注:本文中的SitePress::get_orphan_translations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。