这个原先是有搞过,但是都因为某些原因失败了。显示效果不理想,所以也就搁置了一段时间,如今记录下修改的过程,方便下次查看。
文章源自亦枫博客-https://yflad.cn/1258.html
显示效果如图:文章源自亦枫博客-https://yflad.cn/1258.html
文章源自亦枫博客-https://yflad.cn/1258.html
文章源自亦枫博客-https://yflad.cn/1258.html
1、把下面的文件下载了,解压后放在主题的目录下。文章源自亦枫博客-https://yflad.cn/1258.html
在此感谢张戈提供的源码文章源自亦枫博客-https://yflad.cn/1258.html
百度网盘提取码:[code]vtjn[/code](为防和谐)文章源自亦枫博客-https://yflad.cn/1258.html
文章源自亦枫博客-https://yflad.cn/1258.html
2、将下面代码添加到wordpress主题根目录functions.php模板文件的最后:文章源自亦枫博客-https://yflad.cn/1258.html
- require get_template_directory() . '/show-useragent/show-useragent.php';
文章源自亦枫博客-https://yflad.cn/1258.html
3、打开wordpress主题下的\inc\function目录的comment-template.php文件:
- <?php get_author_admin($comment->comment_author_email, $comment->user_id); ?>
下面添加:
- <span class="flags"><?php CID_print_comment_flag();echo ' ';CID_print_comment_browser(); echo convertip(get_comment_author_ip()); ?></span>
4、将下面配套样式文件添加到主题样式文件style.css最后:
- /* UA信息和IP地址 */
- .WB-OS img {
- width: 14px;
- height: auto;
- vertical-align: -6%;
- }
- .flags {
- display: none;
- }
- @media screen and (min-width: 900px) {
- .comment-body:hover .flags {
- display: inline;
- animation: fade-in;
- animation-duration: 0.3s;
- -webkit-animation: fade-in 0.3s;
- }
- }
至此修改完毕,刷新下即可看到效果。如果有CDN,清理下缓存。
继续阅读
扫扫关注公众号

我的微信
微信号已复制
扫扫体验小程序

我的公众号
公众号已复制

