admin管理员组文章数量:1287884
i am using the wp_list_authors function as the following:
<?php wp_list_authors( array(
'show_fullname' => 'true',
'orderby' => 'display_name',
'order' => 'ASC'
)) ?>
However this shows the authors by firstname + lastname I want to switch that so it shows the users lastname + firstname.
I cant figure out how can i use the get_user_meta in the function.
It is possible or should I use something else than wp_list_authors?
i am using the wp_list_authors function as the following:
<?php wp_list_authors( array(
'show_fullname' => 'true',
'orderby' => 'display_name',
'order' => 'ASC'
)) ?>
However this shows the authors by firstname + lastname I want to switch that so it shows the users lastname + firstname.
I cant figure out how can i use the get_user_meta in the function.
It is possible or should I use something else than wp_list_authors?
Share Improve this question asked Sep 13, 2021 at 10:41 Simó TamásSimó Tamás 175 bronze badges 4 |1 Answer
Reset to default 1What you want is not supported by wp_list_authors()
. To output them the way you want you will need to use get_users()
and display them yourself.
$authors = get_users(
array(
'orderby' => 'display_name',
'order' => 'ASC'
)
);
foreach ( $authors as $author ) {
echo esc_html( $author->last_name . ' ' . $author->first_name );
}
You can wrap the output in elements as needed, and pass $author->ID
to get_user_meta()
if you need any metadata. You can get a link to the author archive using get_author_posts_url()
.
本文标签: user metaCombining wplistauthors with getusermeta
版权声明:本文标题:user meta - Combining wp_list_authors with get_user_meta 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741323325a2372331.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp_list_authors()
does the outputting. – Jacob Peattie Commented Sep 13, 2021 at 10:45