get_avatar()这个函数可以获取用户头像,但是这需要一个判断语句,如果你在首页显示用户头像的话想显示谁的呢?假如根据文章ID判断文章作者的头像获取首页这么多文章确保都是一个人发的文章吗
可用函数get_the_author_meta,如:
1
2
get_the_author_meta( 'nicename' ); //昵称
get_the_author_meta( 'description' ); //描述性文字
头像可以用get_avatar函数,如:
1
get_avatar( get_the_author_meta( 'ID' ), 32 );
你放在 index 里 不放在 single里 就行了 mymoe.cc