
1、下载:show-useragent(显示国籍系统浏览器文件))和 ip2c(显示运营商IP信息文件)
2、上传并解压到WordPress主题目录(解压后得到show-useragent文件夹和ip2c文件夹)
3、将show-useragent和ip2c引入到主题:
将以下代码放到主题目录下的functions.php中
include("ip2c/ip2c.php");//IP归属地和运营商查询功能
include("show-useragent/show-useragent.php");//显示国籍、系统、浏览器信息
4、在需要显示的位置加入以下代码
<span class="ua-info"> <?php CID_print_comment_flag();/*国籍*/ echo ' ';/*空格*/ CID_print_comment_browser();/*浏览器*/ echo convertip(get_comment_author_ip());/*运营商*/ ?> </span>
如:begin主题,则在主题目录下inc/comment-template.php文件,并找到以下代码,加在前面
<span class="comment-meta commentmetadata">
/*调整留言者系统浏览器和运营商位置*/
.ua-info {
margin-left:30px;
}
.WB-OS img{
vertical-align:-3px;
}
5、如需鼠标经过时显示或隐藏以上UA信息和IP地址,则在对应主题footer.php中添加代码
<script>
jQuery(function(){
$(".comment-body").hover(function(){
$(this).find(".ua-info").toggle();
},function(){
$(this).find(".ua-info").toggle();
});
});
</script>
如果显示和隐藏效果相反,则在在对应主题style.css文件内或自定义CSS处,加以下css代码调整
.ua-info {
display:none;/*设置隐藏*/
margin-left:8px;
}






评论