forked from mirror/_s
Correct use of get_queried_object() for author archives.
The ->data object (used previously) stores the author data, but the WP_User class has the __get magic method that grants access to that data, so using get_queried_object() without ->data is correct, and compatible with 3.2, which does not use magic methods. Also url-escapes get_author_posts_url.
This commit is contained in:
parent
dec5c61928
commit
103ae2cdf6
|
@ -26,8 +26,8 @@ get_header(); ?>
|
|||
|
||||
} elseif ( is_author() ) {
|
||||
// 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>' );
|
||||
$author = get_queried_object();
|
||||
printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( 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>' );
|
||||
|
|
Reference in New Issue