教程可以实现对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
更多美化教程可以访问网创熊论坛