温馨提示:这篇文章已超过1172天没有更新,请注意相关的内容是否还可用!
为了区别管理员与游客或网站注册用户的wordpress文章内容评论或评论回复,避免别人冒充管理员,对wordpress的评论或回复作些标注是非常有必要的。对此,做法是给管理员的评论和回复添加Admin个性印章,方法非常简单,原理是判断用户ID是否为管理员ID,是则输出印章样式。效果看截图。
截图预览:
实现方法:
在comments.php或functions.php文件中找到代码
<strong><?php</strong> comment_text(); <strong>?></strong>
在其下面添加以下代码:
<strong><?php</strong> if($comment->user_id == 1){ echo '<span class="admin_author">管理员回复</span>'; } <strong>?></strong>
参考样式,admin.gif为印章图片,sxlog不提供,需要的可以自己制作或网上查找相关素材制作
.admin_author {
<strong>background</strong>:url(<em>images/admin.gif</em>) no-repeat <strong>right</strong> center; <strong>width</strong>:60px;
<strong>height</strong>:41px;
<strong>position</strong>:absolute;
<strong>left</strong>:60%;
<strong>bottom</strong>:5px;
<strong>text-indent</strong>:-9999px;
}
注:需要admin_author的父层添加position:relative;
文章版权声明:除非注明,否则均为折腾博客原创文章,转载或复制请以超链接形式并注明出处。
还没有评论,来说两句吧...