如果我们的WordPress博客有多个作者发表文章时候,我们会需要在文章内显示作者的昵称、头像等资料。
在WordPress实现作者头像的方法也很简单,一行函数代码即可调用到。
调用作者头像
WordPress调用当前文章作者头像
<?php echo get_avatar( get_the_author_email(), '60' );?>
使用方法
将上面代码放在 single.php 就可以后去到作者头像。
如果我们的WordPress博客有多个作者发表文章时候,我们会需要在文章内显示作者的昵称、头像等资料。
在WordPress实现作者头像的方法也很简单,一行函数代码即可调用到。
WordPress调用当前文章作者头像
<?php echo get_avatar( get_the_author_email(), '60' );?>
将上面代码放在 single.php 就可以后去到作者头像。
「陌客网」 WordPress如何调用当前文章作者头像 https://www.moke1.cn/778.html