• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_get_split_terms函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_get_split_terms函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_split_terms函数的具体用法?PHP wp_get_split_terms怎么用?PHP wp_get_split_terms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_get_split_terms函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: custom_output_option

 /**
  * Use custom callback for outputting snippet
  *
  * @param $buf
  * @param $args
  *
  * @return string
  */
 function custom_output_option($buf, $args)
 {
     if ('aiosp_snippet' === $args['name']) {
         $args['options']['type'] = 'html';
         $args['options']['nowrap'] = false;
         $args['options']['save'] = false;
         $info = $this->get_page_snippet_info();
         extract($info);
     } else {
         return '';
     }
     if ($this->strlen($title) > 70) {
         $title = $this->trim_excerpt_without_filters($title, 70) . '...';
     }
     if ($this->strlen($description) > 156) {
         $description = $this->trim_excerpt_without_filters($description, 156) . '...';
     }
     $extra_title_len = 0;
     if (empty($title_format)) {
         $title = '<span id="' . $args['name'] . '_title">' . esc_attr(wp_strip_all_tags(html_entity_decode($title))) . '</span>';
     } else {
         if (strpos($title_format, '%blog_title%') !== false) {
             $title_format = str_replace('%blog_title%', get_bloginfo('name'), $title_format);
         }
         $title_format = $this->apply_cf_fields($title_format);
         $replace_title = '<span id="' . $args['name'] . '_title">' . esc_attr(wp_strip_all_tags(html_entity_decode($title))) . '</span>';
         if (strpos($title_format, '%post_title%') !== false) {
             $title_format = str_replace('%post_title%', $replace_title, $title_format);
         }
         if (strpos($title_format, '%page_title%') !== false) {
             $title_format = str_replace('%page_title%', $replace_title, $title_format);
         }
         if ($w->is_category || $w->is_tag || $w->is_tax) {
             if (AIOSEOPPRO && !empty($_GET) && !empty($_GET['taxonomy']) && !empty($_GET['tag_ID']) && function_exists('wp_get_split_terms')) {
                 $term_id = intval($_GET['tag_ID']);
                 $was_split = get_term_meta($term_id, '_aioseop_term_was_split', true);
                 if (!$was_split) {
                     $split_terms = wp_get_split_terms($term_id, $_GET['taxonomy']);
                     if (!empty($split_terms)) {
                         foreach ($split_terms as $new_tax => $new_term) {
                             $this->split_shared_term($term_id, $new_term);
                         }
                     }
                 }
             }
             if (strpos($title_format, '%category_title%') !== false) {
                 $title_format = str_replace('%category_title%', $replace_title, $title_format);
             }
             if (strpos($title_format, '%taxonomy_title%') !== false) {
                 $title_format = str_replace('%taxonomy_title%', $replace_title, $title_format);
             }
         } else {
             if (strpos($title_format, '%category%') !== false) {
                 $title_format = str_replace('%category%', $category, $title_format);
             }
             if (strpos($title_format, '%category_title%') !== false) {
                 $title_format = str_replace('%category_title%', $category, $title_format);
             }
             if (strpos($title_format, '%taxonomy_title%') !== false) {
                 $title_format = str_replace('%taxonomy_title%', $category, $title_format);
             }
             if (AIOSEOPPRO) {
                 if (strpos($title_format, '%tax_') && !empty($p)) {
                     $taxes = get_object_taxonomies($p, 'objects');
                     if (!empty($taxes)) {
                         foreach ($taxes as $t) {
                             if (strpos($title_format, "%tax_{$t->name}%")) {
                                 $terms = $this->get_all_terms($p->ID, $t->name);
                                 $term = '';
                                 if (count($terms) > 0) {
                                     $term = $terms[0];
                                 }
                                 $title_format = str_replace("%tax_{$t->name}%", $term, $title_format);
                             }
                         }
                     }
                 }
             }
         }
         if (strpos($title_format, '%taxonomy_description%') !== false) {
             $title_format = str_replace('%taxonomy_description%', $description, $title_format);
         }
         $title_format = preg_replace('/%([^%]*?)%/', '', $title_format);
         $title = $title_format;
         $extra_title_len = strlen(str_replace($replace_title, '', $title_format));
     }
     $args['value'] = sprintf($args['value'], $title, esc_url($url), esc_attr(wp_strip_all_tags($description)));
     $extra_title_len = (int) $extra_title_len;
     $args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
     $buf = $this->get_option_row($args['name'], $args['options'], $args);
     return $buf;
 }
开发者ID:recetasdemama,项目名称:wordpress,代码行数:100,代码来源:aioseop_class.php


示例2: wp_get_split_term

/**
 * Get the new term ID corresponding to a previously split term.
 *
 * @since 4.2.0
 *
 * @param int    $old_term_id Term ID. This is the old, pre-split term ID.
 * @param string $taxonomy    Taxonomy that the term belongs to.
 * @return int|false If a previously split term is found corresponding to the old term_id and taxonomy,
 *                   the new term_id will be returned. If no previously split term is found matching
 *                   the parameters, returns false.
 */
function wp_get_split_term($old_term_id, $taxonomy)
{
    $split_terms = wp_get_split_terms($old_term_id);
    $term_id = false;
    if (isset($split_terms[$taxonomy])) {
        $term_id = (int) $split_terms[$taxonomy];
    }
    return $term_id;
}
开发者ID:n8maninger,项目名称:WordPress,代码行数:20,代码来源:taxonomy-functions.php


示例3: test_wp_get_split_terms

 public function test_wp_get_split_terms()
 {
     $found = wp_get_split_terms($this->terms['t1']['term_id']);
     $expected = array('wptests_tax_2' => $this->terms['t2']['term_id'], 'wptests_tax_3' => $this->terms['t3']['term_id']);
     $this->assertEqualSets($expected, $found);
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:6,代码来源:splitSharedTerm.php



注:本文中的wp_get_split_terms函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_theme函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_split_term函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap