VPS参考、测评、推荐
分享你关注的VPS主机优惠信息

为wordpress文章作者评论消息显示“文本作者”提示(WordPress不能评论)

为wordpress文章作者评论消息显示“文本作者”提示(WordPress不能评论)

为wordpress文章作者评论消息显示“文本作者”提示(WordPress不能评论)WordPress当WordPress文章作者在自己的中回复读者的评论消息时,会在名字后显示“作者”的提示,让读者清楚地作者亲自回复他的消息是否鸡冻。

多作者和单作者最好网上盛传的“管理员”提示。

首先,在当前函数模板functions.php中添加以下判断作者的:

//判断文章作者functionzm _ comment _ by _ post _ author($ comment = ){ if(is _ object($ comment)& & amp;$ comment -& gt;user _ id & gt0){ $ user = get _ user data($ comment -& gt;user _ id);$ post = get _ post($ comment -& gt;comment _ post _ ID);如果(!empty($ user)& amp;& amp!empty($ post)){ return $ comment -& gt;user _ id = = = $ post -& gt;post _作者;} }返回false}只需在评论中的显示评论者名称代码后面添加显示调用代码即可。

& lt?PHP $ post _ author = zm _ comment _ by _ post _ author($ comment);if($ post _ author){ echo ‘ & lt;span class=”post-author ” >作者;} ?& gt不同的话题评论代码不一样,只能研究往哪里添加。

显示管理员和作者的调用:

& lt?PHP if($ comment -& gt;comment _ author _ email = = get _ option(‘ admin _ email ‘){ echo ‘ & lt;span class=”author-admin ” >“博客作者”;} else { $ post _ author = zm _ comment _ by _ post _ author($ comment);if($ post _ author){ echo ‘ & lt;span class=”post-author ” >作者;} } ?& gt判断作者代码取自WordPress默认主题Twenty Twenty。虽然主题从外面看起来很简单,但是它真的很强大,有很多值得挖掘的东西。

:为wordpress文章作者评论消息显示“文本作者”提示(WordPress不能评论) ://vps.caogenba../86139.html

赞(0) 打赏
未经允许不得转载:草根吧VPS_最新VPS信息参考 » 为wordpress文章作者评论消息显示“文本作者”提示(WordPress不能评论)
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址