我刚从author.php
文件,共TwentyTwelve
主题:
<?php
/* Queue the first post, that way we know
* what author we\'re dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
the_post();
?>
<header class="archive-header">
<h1 class="archive-title"><?php printf( __( \'Author Archives: %s\', \'twentytwelve\' ), \'<span class="vcard"><a class="url fn n" href="\' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . \'" title="\' . esc_attr( get_the_author() ) . \'" rel="me">\' . get_the_author() . \'</a></span>\' ); ?></h1>
</header><!-- .archive-header -->
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
?>
注意他们是如何获得作者帖子链接的。一开始他们打电话
the_post
函数在主循环外获取第一篇文章。然后他们获得作者信息,如帖子URL和显示名称。最后他们打电话
rewind_posts
用于重置回路的函数。
您可以在header.php
文件