WordPress如何调用当前文章作者头像

WordPress如何调用当前文章作者头像

  • 最近更新2020年07月26日

如果我们的WordPress博客有多个作者发表文章时候,我们会需要在文章内显示作者的昵称、头像等资料。

在WordPress实现作者头像的方法也很简单,一行函数代码即可调用到。

调用作者头像

WordPress调用当前文章作者头像
<?php echo get_avatar( get_the_author_email(), \'60\' );?>

使用方法

将上面代码放在 single.php 就可以后去到作者头像。

分享到 :
相关推荐

发表评论

您的电子邮箱地址不会被公开。