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

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

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

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

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

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

//判断文章作者functionzm _ comment _ by _ post _ author($ comment = ){ if(is _ object($ comment)& & amp;$ comment -& ;user _ id & gt0){ $ user = get _ user data($ comment -& ;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不能评论) https://vps.caogenba.com.com/86139.html

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

评论 抢沙发

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