Skip to content

Commit

Permalink
No need for the_post and rewind_posts in author archives.
Browse files Browse the repository at this point in the history
Merge pull request #36 from kovshenin

Merge remote-tracking branch 'kovshenin/patch-5'
  • Loading branch information
azizur committed Aug 25, 2012
2 parents 0872406 + dec5c61 commit 6e9cac0
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,9 @@
printf( __( 'Tag Archives: %s', '_s' ), '<span>' . single_tag_title( '', false ) . '</span>' );

} elseif ( is_author() ) {
/* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
*/
the_post();
printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( get_the_author_meta( "ID" ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' );
/* 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();
// Get the queried author data.
$author = get_queried_object()->data;
printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( $author->ID ) . '" title="' . esc_attr( $author->display_name ) . '" rel="me">' . esc_html( $author->display_name ) . '</a></span>' );

} elseif ( is_day() ) {
printf( __( 'Daily Archives: %s', '_s' ), '<span>' . get_the_date() . '</span>' );
Expand Down

0 comments on commit 6e9cac0

Please sign in to comment.