为了区别管理员与游客或网站注册用户的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;

© 版权声明
THE END
请登录后发表评论
注册
社交帐号登录