分类/标签页面文章数总计、描述隐藏

对于标签内描述,感谢没必要,因为太多……完全是个人看法啊,如果你有不同看法……请以我看法为准!

1-4

1-5

子比V6.6及以上版本

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

admin-options.php

zibll/inc/options/admin-options.php

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

1-6

array(
                'title'   => __('显示分类描述', 'zib_language'),
                'id'      => 'cat_show_desc',
                'type'    => 'switcher',
                'default' => true,
            ),
  • admin-options.php 搜索 “标签页面” ,下面插入红框代码

1-7

 

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);
    $title = '<i class="fa fa-folder-open em12 mr10 ml6" aria-hidden="true"></i>' . $cat->cat_name;

    if (_pz('cat_post_count_s', true)) {
        $count = zib_get_the_found_posts();
        $title .= '<span class="icon-spot">共' . $count . '篇</span>';
    }
    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-left">' . $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);
    $title  = '<i class="fa fa-tags em12 mr10 ml6" aria-hidden="true"></i>' . $tag->name;

    if (_pz('tag_post_count_s', true)) {
        $count = zib_get_the_found_posts();
        $title .= '<span class="icon-spot">共' . $count . '篇</span>';
    }

    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-left">' . $title . '</h4>';
        echo '<div class="muted-2-color">' . $desc . '</div>';
        echo '</div>';
    }
}

子比V6.5.2及以下版本

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

admin-options.php

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

3-3

array(
                'title'   => __('显示文章总计', 'zib_language'),
                'id'      => 'page_cat_sum_s',
                'type'    => 'switcher',
                'default' => true,
            ),
            array(
                'title'   => __('显示分类描述', 'zib_language'),
                'id'      => 'cat_show_desc',
                'type'    => 'switcher',
                'default' => true,
            ),
  • admin-options.php 搜索 “标签页面” ,下面插入红框代码

4-1

array(
                'title'   => __('显示文章总计', 'zib_language'),
                'id'      => 'page_tag_sum_s',
                'type'    => 'switcher',
                'default' => true,
            ),
            array(
                'title'   => __('显示分类描述', 'zib_language'),
                'id'      => 'tag_show_desc',
                'type'    => 'switcher',
                'default' => true,
            ),

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>';
    }
}

最后

  • 修改文件具有风险,注意备份相关文件
 
© 版权声明
THE END
如果喜欢,可以【点赞】【分享】【收藏】
点赞7赞赏 分享
评论 共1条
头像
人生坎坎,山山而峦,不过尔尔;心路漫漫,水水而川,如此悠悠
提交
头像

昵称

取消
昵称表情代码图片