Zibll子比主题美化 分类/标签页面文章数总计、描述隐藏(新增)

Jaysun

对于分类标签内数量及分类描述,对有些网站还是有很大帮助的,但是对少部分人可能觉得多此一举,没有必要进行展示,今天就分享 一个如何关闭分类标签数量和描述的方法。

Zibll子比主题美化 分类/标签页面文章数总计、描述隐藏(新增)

Zibll子比主题美化 分类/标签页面文章数总计、描述隐藏(新增)


使用教程:

子比V6.6及以上版本

以下代码适用于子比V6.6及以上版本

admin-options.php

zibll/inc/options/admin-options.php

  • admin-options.php 搜索分类页面” ,下面插入红框代码

1.webp (1).jpg

付费内容
售价:5 积分
开通青铜VIP或更高级的会员可免费查看该内容
登录注册购买

zib-category.php

  • zibll/inc/functions/zib-category.php

  • 搜索 “zib_cat_cover()”函数,整个函数替换:

function zib_cat_cover($cat_id = '')
{
    if (!$cat_id) {
        $cat_id = get_queried_object_id();
    }
    if (_pz('cat_show_desc', true)){
        $desc = trim(strip_tags(category_description()));
        if (is_super_admin() && !$desc) {
            $desc = '请在wordress后台-文章-文章分类中添加分类描述!';
        }
    
        $desc .= zib_get_term_admin_edit('编辑此分类');
    }
    //global $wp_query;

    $cat   = get_category($cat_id);
    $count = zib_get_the_found_posts();
    $title = '<i class="fa fa-folder-open em12 mr10 ml6" aria-hidden="true"></i>' . $cat->cat_name;
    if (_pz('page_cat_sum_s', true)){
        $title .= '<span class="icon-spot">共' . $count . '篇</span>';
    } else {
        $title .= '';
    } 
    //$title .='<pre>'. json_encode($wp_query) .'</pre>';
    if (_pz('page_cover_cat_s', true)) {
        $img = zib_get_taxonomy_img_url(null, null, _pz('cat_default_cover'));
        zib_page_cover($title, $img, $desc);
    } else {
        echo '<div class="zib-widget">';
        echo '<h4 class="title-h-center">' . $title . '</h4>';
        echo '<div class="muted-2-color">' . $desc . '</div>';
        echo '</div>';
    }
}
  • 同理搜索 “zib_tag_cover()”函数,整个函数替换:

function zib_tag_cover()
{
    if (_pz('tag_show_desc', true)){
        $desc = trim(strip_tags(tag_description()));
        if (is_super_admin() && !$desc) {
            $desc = '请在Wordress后台-文章-文章分类中添加标签描述!';
        }
    
        $desc .= zib_get_term_admin_edit('编辑此标签');
    }
    global $wp_query;
    $tag_id = get_queried_object_id();
    $tag    = get_tag($tag_id);
    $count  = $tag->count;
    $title  = '<i class="fa fa-tag em12 mr10 ml6" aria-hidden="true"></i>' . $tag->name;
    if (_pz('page_tag_sum_s', true)){
      $title .= '<span class="icon-spot">共' . $count . '篇</span>';
    } else {
        $title .= '';
    } 
    if (_pz('page_cover_tag_s', true)) {
        $img = zib_get_taxonomy_img_url(null, null, _pz('tag_default_cover'));
        zib_page_cover($title, $img, $desc);
    } else {
        echo '<div class="zib-widget">';
        echo '<h4 class="title-h-center">' . $title . '</h4>';
        echo '<div class="muted-2-color">' . $desc . '</div>';
        echo '</div>';
    }
}

最后

  • 修改文件具有风险,注意备份相关文件


您需要 登录账户 后才能发表评论

发表评论

快捷回复: 表情:
AddoilApplauseBadlaughBombCoffeeFabulousFacepalmFecesFrownHeyhaInsidiousKeepFightingNoProbPigHeadShockedSinistersmileSlapSocialSweatTolaughWatermelonWittyWowYeahYellowdog
评论列表 (暂无评论,829人围观)

还没有评论,来说两句吧...

目录[+]

取消
微信二维码
微信二维码
支付宝二维码