本文整理汇总了PHP中is_taxonomy_translated函数的典型用法代码示例。如果您正苦于以下问题:PHP is_taxonomy_translated函数的具体用法?PHP is_taxonomy_translated怎么用?PHP is_taxonomy_translated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_taxonomy_translated函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
add_action('registered_taxonomy', array($this, 'init'), 10, 0);
$taxonomies = get_taxonomies();
foreach ($taxonomies as $taxonomy) {
if (is_taxonomy_translated($taxonomy)) {
add_filter("pre_option_{$taxonomy}_children", array($this, 'pre_option_tax_children'), 10, 0);
add_action("create_{$taxonomy}", array($this, 'update_tax_children_option'), 10, 0);
add_action("edit_{$taxonomy}", array($this, 'update_tax_children_option'), 10, 0);
}
}
}
示例2: slug_template
/**
* Adjust template (taxonomy-)$taxonomy-$term.php for translated term slugs and IDs
*
* @since 3.1
*
* @param string $template
*
* @return string The template filename if found.
*/
function slug_template($template)
{
global $sitepress;
if (($term = $this->get_queried_tax_term()) === false) {
return $template;
}
$taxonomy = $term->taxonomy;
$templates = array();
remove_filter('get_term', array($sitepress, 'get_term_adjust_id'), 1);
$current_language = $sitepress->get_current_language();
$default_language = $sitepress->get_default_language();
if (is_taxonomy_translated($taxonomy) && $current_language !== $default_language) {
$templates = $this->add_term_templates($term, $current_language, $templates);
$templates = $this->add_original_term_templates($term, $default_language, $current_language, $templates);
}
if (!in_array($taxonomy, array('category', 'post_tag'), true)) {
$templates[] = 'taxonomy-' . $current_language . '.php';
$templates[] = 'taxonomy.php';
}
add_filter('get_term', array($sitepress, 'get_term_adjust_id'), 1, 1);
$new_template = locate_template(array_unique($templates));
$template = $new_template ? $new_template : $template;
return $template;
}
示例3: maybe_load_translated_tax_screen
function maybe_load_translated_tax_screen()
{
$taxonomy_get = (string) filter_input(INPUT_GET, 'taxonomy');
$taxonomy_get = $taxonomy_get ? $taxonomy_get : 'post_tag';
if (is_taxonomy_translated($taxonomy_get)) {
global $wpdb, $sitepress;
require ICL_PLUGIN_PATH . '/menu/term-taxonomy-menus/wpml-tax-menu-loader.class.php';
new WPML_Tax_Menu_Loader($wpdb, $sitepress, $taxonomy_get);
}
}
示例4: get_object_id
/**
* @param int $element_id
* @param string $element_type
* @param bool|false $return_original_if_missing
* @param null $language_code
*
* @return int|null
*/
function get_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $language_code = null)
{
global $wp_post_types, $wp_taxonomies;
$ret_element_id = null;
if ($element_id) {
$language_code = $language_code ? $language_code : $this->get_current_language();
if ($element_type == 'any') {
$post_type = get_post_type($element_id);
if ($post_type) {
$element_type = $post_type;
} else {
$element_type = null;
}
}
if ($element_type) {
if (isset($wp_taxonomies[$element_type])) {
/** @var WPML_Term_Translation $wpml_term_translations */
global $wpml_term_translations;
$ret_element_id = is_taxonomy_translated($element_type) ? $wpml_term_translations->term_id_in($element_id, $language_code) : $element_id;
} elseif (isset($wp_post_types[$element_type])) {
/** @var WPML_Post_Translation $wpml_post_translations */
global $wpml_post_translations;
$ret_element_id = is_post_type_translated($element_type) ? $wpml_post_translations->element_id_in($element_id, $language_code) : $element_id;
} else {
$ret_element_id = null;
}
$ret_element_id = $ret_element_id ? (int) $ret_element_id : ($return_original_if_missing && !$ret_element_id ? $element_id : null);
}
}
return $ret_element_id;
}
示例5: save_term_actions
/**
*
* @global SitePress $sitepress
* @global WPML_Term_Translation $wpml_term_translations
*
* @ignore $cat_id
*
* @param int $tt_id Taxonomy Term ID of the saved Term
* @param string $taxonomy Taxonomy of the saved Term
*
*/
public function save_term_actions($cat_id, $tt_id, $taxonomy)
{
/** @var WPML_Term_Translation $wpml_term_translations */
global $sitepress, $wpml_term_translations;
if (!is_taxonomy_translated($taxonomy)) {
return;
}
$post_action = filter_input(INPUT_POST, 'action');
$term_lang = $this->get_term_lang($tt_id, $post_action, $taxonomy);
$trid = $this->get_saved_term_trid($tt_id, $post_action);
$src_language = $wpml_term_translations->get_source_lang_code($tt_id);
$sitepress->set_element_language_details($tt_id, 'tax_' . $taxonomy, $trid, $term_lang, $src_language);
}
示例6: is_translated_type
public function is_translated_type($element_type)
{
is_taxonomy_translated($element_type);
}
示例7: get_terms_args_filter
function get_terms_args_filter($args, $taxonomies)
{
$translated = false;
foreach ((array) $taxonomies as $tax) {
if (is_taxonomy_translated($tax)) {
$translated = true;
}
}
if ($translated === false) {
return $args;
}
if (isset($args['cache_domain'])) {
$args['cache_domain'] .= '_' . $this->get_current_language();
}
$include_arr = $this->adjust_taxonomies_terms_ids($args['include']);
if (!empty($include_arr)) {
$args['include'] = $include_arr;
}
$exclude_arr = $this->adjust_taxonomies_terms_ids($args['exclude']);
if (!empty($exclude_arr)) {
$args['exclude'] = $exclude_arr;
}
$exclude_tree_arr = $this->adjust_taxonomies_terms_ids($args['exclude_tree']);
if (!empty($exclude_tree_arr)) {
$args['exclude_tree'] = $exclude_tree_arr;
}
$child_id_arr = isset($args['child_of']) ? $this->adjust_taxonomies_terms_ids($args['child_of']) : array();
if (!empty($child_id_arr)) {
$args['child_of'] = array_pop($child_id_arr);
}
$parent_arr = isset($args['parent']) ? $this->adjust_taxonomies_terms_ids($args['parent']) : array();
if (!empty($parent_arr)) {
$args['parent'] = array_pop($parent_arr);
}
// special case for when term hierarchy is cached in wp_options
$debug_backtrace = $this->get_backtrace(5);
//Limit to first 5 stack frames, since 4 is the highest index we use
if (isset($debug_backtrace[4]) && $debug_backtrace[4]['function'] == '_get_term_hierarchy') {
$args['_icl_show_all_langs'] = true;
}
return $args;
}