show-useragent放域名跟目录和主题根目录各一份
ip2c放主题目录
加入以下代码到function.php
include("ip2c/ip2c.php"); //IP 归属地和运营商查询功能
include("show-useragent/show-useragent.php"); //显示访客信息
找到以下文件
/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>';
补充
使用CDN会出现IP显示不准确和只显示一个地区的问题在wp-config.php里加入底下代码就可以解决!直接添加在<?php下面
//获取访客真实IP地址
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
};
项目来源于网络,防止被割韭菜!
本站初心:用更少的米,学习更多的知识!
© 版权声明
文章版权归原作者所有,本站只做转载和学习。声明:下载本站资源即同意用户协议,本站程序只是提供给同学们学习研究。
THE END
暂无评论内容