admin管理员组文章数量:1389572
I want to just show the author's name (unlinked to author archive).
I don't want to show the author's avatar.
I have used some plugins but I got failed.
I want to just show the author's name (unlinked to author archive).
I don't want to show the author's avatar.
I have used some plugins but I got failed.
Share Improve this question edited Mar 23, 2020 at 10:19 cjbj 15k16 gold badges42 silver badges89 bronze badges asked Mar 21, 2020 at 15:09 Zain Ul AabideenZain Ul Aabideen 11 bronze badge 1- Was my answer helpful to you?! Please accept and upvote if was helpful – WordPress Speed Commented Mar 28, 2020 at 16:05
1 Answer
Reset to default 0You may use the the_author_meta
function:
the_author_meta( string $field = '', int|false $user_id = false )
You may provide $field
which is of these values:
admin_color
aim
comment_shortcuts
description
display_name
first_name
ID
jabber
last_name
nickname
plugins_last_view
plugins_per_page
rich_editing
syntax_highlighting
user_activation_key
user_description
user_email
user_firstname
user_lastname
user_level
user_login
user_nicename
user_pass
user_registered
user_status
user_url
yim
and is well documented here. In your case you may choose display_name
.
Also you may provide the $user_id
. If you don't provide it, it will be the current author's DB object (author of current post).
If you want to get the name for some string manipulation and not directly printing on the output, just use get_the_author_meta()
.
本文标签: theme developmentHow to display only author39s name for the current post
版权声明:本文标题:theme development - How to display only author's name for the current post? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744648620a2617550.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论