本文整理匯總了PHP中SitePress::set_admin_language方法的典型用法代碼示例。如果您正苦於以下問題:PHP SitePress::set_admin_language方法的具體用法?PHP SitePress::set_admin_language怎麽用?PHP SitePress::set_admin_language使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SitePress
的用法示例。
在下文中一共展示了SitePress::set_admin_language方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wpml_get_table_taxonomies
public static function wpml_get_table_taxonomies(SitePress $sitepress)
{
$taxonomies = $sitepress->get_wp_api()->get_taxonomies(array(), 'objects');
$result = array("taxonomies" => array(), "activeLanguages" => array(), "allLanguages" => array());
$sitepress->set_admin_language();
$active_langs = $sitepress->get_active_languages();
$default_lang = $sitepress->get_default_language();
$result["activeLanguages"][$default_lang] = array("label" => $active_langs[$default_lang]['display_name'], "flag" => $sitepress->get_flag_url($default_lang));
foreach ($active_langs as $code => $lang) {
if ($code !== $default_lang) {
$result["activeLanguages"][$code] = array("label" => $lang['display_name'], "flag" => $sitepress->get_flag_url($code));
}
}
$all_languages = $sitepress->get_languages();
foreach ($all_languages as $code => $lang) {
$result["allLanguages"][$code] = array("label" => $lang['display_name'], "flag" => $sitepress->get_flag_url($code));
}
foreach ($taxonomies as $key => $tax) {
if ($sitepress->is_translated_taxonomy($key)) {
$result["taxonomies"][$key] = array("label" => $tax->label, "singularLabel" => $tax->labels->singular_name, "hierarchical" => $tax->hierarchical, "name" => $key);
}
}
return $result;
}