子比主题用户中心和用户页添加UID及靓号图标显示

教程可以实现对uid的简单判断,实现靓号显示靓号icon,非靓号实现显示普通icon

先上图

用户中心

用户页

教程开始

首先在后台自定义底部HTML代码出引入图标

<script src="//at.alicdn.com/t/c/font_4663829_62hxlzm8aqo.js"></script>

用户中心:

修改位置/wp-content/themes/zibll/inc/functions/user/page.php文件

1、复制下面代码,搜索查找,并删除或注释掉该行

$info_html_flex1 .= '<div class="desc user-identity flex ac hh">' . $desc . '</div>';

2、复制下面代码,粘贴在刚刚的位置处

/*用户页UID美化*网创熊 wyuuu.cn*/
        $numStr = strval($user_id);
        $uesrid_L6 = str_pad($user_id, 6, "0", STR_PAD_LEFT);
        // 检查 $user_id 的特定条件
        if (($user_id % 10 == 0) || ($user_id <= 11)) {
        // 如果 $user_id 是 10 的整数倍或小于等于 10,使用特定图片
        $info_html_flex1.= '<div class="user-identity flex ac hh">'.
        '<span class="but c-red" style="--this-bg: linear-gradient(45deg, #FFD700 0%, #e6c75b 30%, #f3eb64 70%, #FFA500 100%); color: rgb(27, 38, 44); overflow: hidden; position: relative; font-weight: bold; data-clipboard-tag="ID" data-clipboard-text="'.$user_id.'">'.
            '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jinghao"></use></svg>UID:'.$uesrid_L6.
        '</span>'.
        $desc.
        '</div>';
          } else {
        $info_html_flex1.= '<div class="user-identity flex ac hh">'.
        '<span class="but c-red" style="--this-bg: linear-gradient(45deg, #FFF0F5 0%, #a1afc9 100%); color: rgb(27, 38, 44); overflow: hidden; position: relative; font-weight: bold; data-clipboard-tag="ID" data-clipboard-text="'.$user_id.'">'.
            '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-aishenghuo-putongqu-pu"></use></svg>UID:'.$uesrid_L6.
        '</span>'.
        $desc.
        '</div>';
}
/*用户页UID美化*网创熊 wyuuu.cn*/

用户页

1、复制下面代码,搜索查找,并删除或注释掉该行

$info_html .= $identity ? '<div class="user-identity flex ac hh">' . $identity . '</div>' : '';

2、复制下面代码,粘贴在刚刚的位置处

 // 用户页 uid 开始 网创熊 wyuu.cn
    // 确保 $author_id 是字符串并至少 6 位,左边用 0 填充
    $author_id_str = str_pad((string)$author_id, 6, '0', STR_PAD_LEFT);
    // 检查 $author_id 的特定条件
    if (($author_id % 10 == 0) || ($author_id <= 11)) {
    // 如果 $author_id 是 10 的整数倍或小于等于 10,使用特定图片
    $info_html.= $identity? '<div class="user-identity flex ac hh">'.
        '<span class="but c-red" style="--this-bg: linear-gradient(45deg, #FFD700 0%, #e6c75b 30%, #f3eb64 70%, #FFA500 100%); color: rgb(27, 38, 44); overflow: hidden; position: relative; font-weight: bold; data-clipboard-tag="ID" data-clipboard-text="'.$author_id_str.'">'.
            '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jinghao"></use></svg>'."UID:".$author_id_str.
        '</span>'.
        $identity.
        '</div>' : '';
     } else {
    $info_html.= $identity? '<div class="user-identity flex ac hh">'.
        '<span class="but c-red" style="--this-bg: linear-gradient(45deg, #FFF0F5 0%, #a1afc9 100%); color: rgb(27, 38, 44); overflow: hidden; position: relative; font-weight: bold; data-clipboard-tag="ID" data-clipboard-text="'.$author_id_str.'">'.
            '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-aishenghuo-putongqu-pu"></use></svg>'."UID:".$author_id_str.
        '</span>'.
        $identity.
        '</div>' : '';
       }
       // 用户页 uid 结束 网创熊 wyuu.cn

更多美化教程可以访问网创熊论坛

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值