Skip to content

Commit

Permalink
Merge pull request #508 from Automattic/fixes/avatar-duplication
Browse files Browse the repository at this point in the history
Fix avatar duplication
  • Loading branch information
laurelfulford authored Oct 15, 2019
2 parents 49a633e + 9d98b51 commit ef29c1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 45 deletions.
14 changes: 1 addition & 13 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,7 @@ function newspack_posted_by() {
printf(
/* translators: 1: Author avatar. 2: post author, only visible to screen readers. 3: author link. */
'<span class="author-avatar">%1$s</span><span class="byline"><span>%2$s</span> <span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
wp_kses(
get_avatar( get_the_author_meta( 'ID' ) ),
array(
'img' => array(
'alt' => array(),
'src' => array(),
'srcset' => array(),
'class' => array(),
'width' => array(),
'height' => array(),
),
)
),
get_avatar( get_the_author_meta( 'ID' ) ),
esc_html__( 'by', 'newspack' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
Expand Down
44 changes: 12 additions & 32 deletions template-parts/post/author-bio.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,25 @@
<div class="author-bio">

<?php
if ( ! newspack_is_active_style_pack( 'style-4' ) ) :
if ( ! newspack_is_active_style_pack( 'style-4' ) ) {
$author_avatar = get_avatar( get_the_author_meta( 'ID' ), 80 );
if ( $author_avatar ) :
echo wp_kses(
$author_avatar,
array(
'img' => array(
'src' => array(),
'alt' => array(),
'class' => array(),
'width' => array(),
'height' => array(),
),
)
);
endif;
endif;
if ( $author_avatar ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $author_avatar;
}
}
?>

<div class="author-bio-text">
<div class="author-bio-header">
<?php
if ( newspack_is_active_style_pack( 'style-4' ) ) :
if ( newspack_is_active_style_pack( 'style-4' ) ) {
$author_avatar = get_avatar( get_the_author_meta( 'ID' ), 80 );
if ( $author_avatar ) :
echo wp_kses(
$author_avatar,
array(
'img' => array(
'src' => array(),
'alt' => array(),
'class' => array(),
'width' => array(),
'height' => array(),
),
)
);
endif;
endif;
if ( $author_avatar ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $author_avatar;
}
}
?>

<div>
Expand Down

0 comments on commit ef29c1c

Please sign in to comment.