百度已收录

子比主题-评论显示漂亮勋章

介绍

给自己的评论区添加一个漂亮的徽章美化,当时看狐狸库的文章评论有这个,然后我就发现我的插件中也有,但是效果不好,这次从网上看见了一些教程,都是付费的,在我这里直接免费。

温馨提示:未注册的用户是:00000,因为他没有正式的ID

子比主题-评论显示漂亮勋章-狐狸库

部署教程

首先在网站/wp-content/themes/zibll 主题目录下新增func.php或者直接在functions.php中添加

function wxs_footer_info_add_img_bill($info, $comment, $depth)
{
    $user_ip = $comment->comment_author_IP;
    if ($user_ip) {
         //$user_ip_name = convertip(get_comment_author_ip());
        // $replyText_html = '<span class="reply-link">' .'' . '</span><span style="cursor:pointer" data-toggle="tooltip" alt="IP:'.$user_ip.'" data-original-title="IP地址:'.$user_ip_name.'">'.mb_substr($user_ip_name,-3,3,"utf-8").'</span>';
         $img_list = array('/pic/dtkp-000.png', '/pic/dtkp-001.png', '/pic/dtkp-002.png', '/pic/dtkp-003.png', '/pic/dtkp-004.png', '/pic/dtkp-005.png', '/pic/dtkp-006.png', '/pic/dtkp-007.png', '/pic/dtkp-008.png', '/pic/dtkp-009.png', '/pic/dtkp-010.png', '/pic/dtkp-011.png', '/pic/dtkp-012.png', '/pic/dtkp-013.png', '/pic/dtkp-014.png', '/pic/dtkp-016.png', '/pic/dtkp-017.png', '/pic/dtkp-018.png', '/pic/dtkp-019.png', '/pic/dtkp-020.png', '/pic/dtkp-021.png', '/pic/dtkp-022.png', '/pic/dtkp-023.png', '/pic/dtkp-024.png', '/pic/dtkp-025.png');
         $color_list = array("rgb(138, 154, 247)", "rgb(187, 103, 138)","rgb(166, 236, 149)","rgb(172, 170, 94)","rgb(240, 88, 88)","rgb(182, 117, 243)","rgb(219, 96, 157)","rgb(245, 107, 72)"
         ,"rgb(196, 167, 104)","rgb(221, 42, 42)","rgb(240, 158, 226)","rgb(243, 200, 98)","rgb(248, 155, 200)","rgb(114, 153, 238)","rgb(214, 207, 107)","rgb(192, 127, 235)","rgb(197, 184, 30)","rgb(245, 155, 210)","rgb(231, 197, 152)","rgb(98, 98, 119)","rgb(221, 200, 173)","rgb(110, 175, 187)","rgb(137, 141, 190)","rgb(166, 152, 238)","rgb(104, 192, 207)","rgb(216, 124, 152)");
         $img_res=array_rand($img_list);
         $color_res=array_rand($color_list);
          
         $bill_html = '<div class="bili-dyn-item__ornament"><div class="bili-dyn-ornament"><div class="bili-dyn-ornament__type--3"><img  src="' . $img_list[$img_res]. '" alt="蜡笔小新"><span style="color:' . $color_list[$color_res] . '">'.str_pad($comment->user_id,5,"0",STR_PAD_LEFT).'</span></div></div></div>';
            $info = $info .$bill_html;
        // $info = $info .$replyText_html .$bill_html;
    }
    return $info;
}
add_filter('comment_footer_info', 'wxs_footer_info_add_img_bill', 10, 3);

当然,这里也需要在子比后台添加一个CSS代码

/*网站评论美化*/
.bili-dyn-item__ornament {
    position: sticky;
    /*right: 48px;*/
    top: 18px;
    margin-top: -10px;
    float: right;
}
.bili-dyn-ornament__type--3 {
    height: 44px;
    width: 146px;
}
.bili-dyn-ornament img {
    height: 100%;
    width: 100%;
}
.bili-dyn-ornament__type--3 span {
    font-family: num !important;
    font-size: 12px;
    position: absolute;
    right: 54px;
    top: 15px;
    transform: scale(.88);
    transform-origin: right;
}
  @font-face {
                font-family: num;
                src: url('data:font/ttf;base64,AAEAAAAKAIAAAwAgT1MvMlfu6qkAAACsAAAAYGNtYXAZKRS8AAABDAAAAVpnbHlmPpOLigAAAmgAAAI0aGVhZA1ca6UAAAScAAAANmhoZWEGkALDAAAE1AAAACRobXR4JmQFBgAABPgAAAA4bG9jYQPqA14AAAUwAAAAHm1heHAAEgAOAAAFUAAAACBuYW1ly5ItMwAABXAAAAagcG9zdADLALIAAAwQAAAAPgAEAvQBkAAFAAgCAAIAAAAAAAIAAgAAAAIAADMBCQAAAgEGBAAAAAAAAIAAAAEQAAAAAAAAAAAAAABKQkhHAEAALgBPA3D/NAB0A3AAzAAEAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAAAAABUAA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YQBjAGsARwBCAFYAMQAuADAAQwBvAHAAeQByAGkAZwBoAHQAKABjACkAIAAyADAAMQA1ACAAUgBFAEUASgBJACAAlQAQAFsAVwBdAOUAYgA/AA0ACgBTAGgAYQBuAGcAIABoAGEAaQAgAFIAdQBpACAAWABpAGEAbgAgAEMAcgBlAGEAdABpAHYAZQAgAEQAZQBzAGkAZwBuACAAQwBvAC4AIABMAHQAZAAuAP8ADAANAAoATgAKAG0AdwCVABAAfgC/AFIAGwBhAA8AiwC+AIsAoQBnAAkAlgBQAFEAbABTAPgADQAKAHcAdwB3AC4AcgBlAGUAagBpAC4AYwBvAG0ADQAKAFEAUQA6ADIANwA3ADAAOAA1ADEANwAzADMADQAKAE0AYQBpAGwAOgBSAGUAZQBqAGkAZgBvAG4AdABAAG8AdQB0AGwAbwBvAGsALgBjAG8AbQACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAARABMAFAAVABYAFwAYABkAGgAbABwAMQAyAAA=');
            }
/*手机适配*/
@media (max-width: 420px){
.bili-dyn-ornament__type--3 {
    width: 11rem !important;
}
}

图片请点击跳转到我的博客下载~[第二十一期]子比主题-评论显示漂亮勋章-科技语者 (chgskj.cn)

温馨提示:本文最后更新于2024/09/07 09:30:16。若文章内容或图片失效,请留言联系站长反馈!
!
也想出现在这里? 联系我们
创意广告
子比主题-评论显示漂亮勋章-狐狸库
子比主题-评论显示漂亮勋章
此内容为免费阅读,请登录后查看
狸币0
网络收集
虚拟资源
自动发货
永久使用
免费阅读
© 版权声明
THE END
点赞0 分享
评论 共1条

请登录后发表评论

    请登录后查看评论内容