子比主题配置评论显示所在IP地区和使用设备

前几天 各大平台应用了  评论显示地区显示国家,显示浏览器,显示手机或电脑 如:抖音 微博 快手….

今天天明博客教大家如何修改 我们的子比主题显示评论地区

代码已经为大家修改好了 只需要上传即可调用,废话不多说 直接上教程!

1.先下载我们的代码包

2.替换代码 非常简单 不会联系博主,不免费 不白嫖 低情商别来

由天明博客修复加强处理

把本压缩包上传到主题的根目录,注意不是WordPress根目录
加入functions.php
在 php 作用域内,添加两行代码:

include("show-useragent/show-useragent.php");   // 显示访客信息
include("show-useragent/ip2c-text.php");        // IP归属地和运营商查询功能

/wp-content/themes/zibll/inc/functions/zib-comments-list.php 51行的 return '<name class="flex ac flex1">

替换代码

$ip = convertip(get_comment_author_ip());
    return '<name class="flex ac flex1">' . $user_name . $badge .'<span class="badg badge badg-sm flex0 ml3">'.$ip.'</span>'.'</name>';


然后 搜索 $time_html 在第一个 //时间  直接替换 代码
$diqu =  CID_get_comment_browser();
$diqu .= CID_print_comment_flag();
$time_html = '<span class="comt-author"' . ($is_mobile ? ' data-toggle="tooltip"' : '') . ' title="' . date('Y年m月d日 H:i:s', strtotime($comment->comment_date)) . '">' . zib_get_time_ago($comment->comment_date) . '</span>'.'<span class="comt-author" title="">'.$diqu.'</span>';

效果预览

图片[5]-子比主题配置评论显示所在IP地区和使用设备
© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 共20条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像2222222220
    • 头像火狼网络0
    • 头像jiuan1
    • 头像淇云博客0