diff --git a/newspack-sacha/template-parts/post/author-bio.php b/newspack-sacha/template-parts/post/author-bio.php index 52b71bc89..e1f2f3fc1 100644 --- a/newspack-sacha/template-parts/post/author-bio.php +++ b/newspack-sacha/template-parts/post/author-bio.php @@ -21,23 +21,33 @@ foreach ( $authors as $author ) { if ( '' !== $author->description ) { - $author_avatar = coauthors_get_avatar( $author, 80 ); + // avatar_img_tag is a property added by Newspack Network plugin to distributed posts. + $author_avatar = $author->avatar_img_tag ?? coauthors_get_avatar( $author, 80 ); + $author_url = get_author_posts_url( $author->ID, $author->user_nicename ); ?>
- + + +

- + + +

user_email ) : ?> @@ -54,22 +64,25 @@

description ), $author_bio_length ) ); ?> - + + +

description ) ); ?> - - + + + ID ); ?> @@ -90,7 +103,8 @@
+ if ( $author_avatar ) { + ?>

diff --git a/newspack-theme/inc/template-tags.php b/newspack-theme/inc/template-tags.php index 052d48611..416f8bcac 100755 --- a/newspack-theme/inc/template-tags.php +++ b/newspack-theme/inc/template-tags.php @@ -95,7 +95,8 @@ function newspack_posted_by() { $i = 1; foreach ( $authors as $author ) { - $author_avatar = coauthors_get_avatar( $author, 80 ); + // avatar_img_tag is a property added by Newspack Network plugin to distributed posts. + $author_avatar = $author->avatar_img_tag ?? coauthors_get_avatar( $author, 80 ); echo '' . wp_kses( $author_avatar, newspack_sanitize_avatars() ) . ''; } @@ -117,11 +118,21 @@ function newspack_posted_by() { $sep = ''; endif; + $author_link = get_author_posts_url( $author->ID, $author->user_nicename ); + + if ( '#' !== $author_link ) { + $author_name = sprintf( + '%2$s', + esc_url( $author_link ), + esc_html( $author->display_name ) + ); + } else { + $author_name = esc_html( $author->display_name ); + } + printf( - /* translators: 1: author link. 2: author name. 3. variable seperator (comma, 'and', or empty) */ - '%2$s%3$s ', - esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ), - esc_html( $author->display_name ), + '%1$s%2$s ', + $author_name, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. esc_html( $sep ) ); } @@ -625,7 +636,7 @@ function newspack_tertiary_menu() { description ) { - $author_avatar = coauthors_get_avatar( $author, 80 ); + // avatar_img_tag is a property added by Newspack Network plugin to distributed posts. + $author_avatar = $author->avatar_img_tag ?? coauthors_get_avatar( $author, 80 ); + $author_url = get_author_posts_url( $author->ID, $author->user_nicename ); ?>