在黑暗中拍摄,因为这不属于我的专业领域-
所有默认主题的作者页面顶部都有这样一个块:
<?php
/*
* Queue the first post, that way we know who
* the author is when we try to get their name,
* URL, description, avatar, etc.
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
if ( have_posts() )
the_post();
?>
设置
$authordata
全球声明:
get_the_author_meta()
依赖于未指定用户ID参数的时间。(如果作者没有发表任何东西,它也可能不起作用。)
上列出的替代方式Author Templates codex page 是根据查询参数自己获取作者
<?php
$curauth = (isset($_GET[\'author_name\'])) ? get_user_by(\'slug\', $author_name)
: get_userdata(intval($author));
?>
并从中读取属性。另一种方式对我来说似乎更好,特别是因为wp includes/query应该为我们进行这种查找(?),但这可能更普遍。