WordPress子比主题评论显示IP属地地址

图片[1]-WordPress子比主题评论显示IP属地地址

主文件下载

首先先下载这个主文件,然后上传到程序子比主题,wp-content/themes/zibll目录里面,然后直接解压。

然后复制这个show-useragent文件目录,然后粘贴到网站根目录。

子比主题评论显示IP
zip文件
10.9M

第一步

wp-content/themes/zibll目录的functions.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行的代码注释掉,并且添加代码。

图片[2]-WordPress子比主题评论显示IP属地地址

代码如下:

$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>';

第三步

然后咱们再找到第94行代码,然后注释掉,并且添加代码。

图片[3]-WordPress子比主题评论显示IP属地地址

代码如下:

$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>';

好了教程到此结束,有什么不懂的可以在下方评论区留言。

© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享