Skip to content

Commit

Permalink
Twenty Nineteen: Fixes and improvements.
Browse files Browse the repository at this point in the history
This commit brings over several changes that occurred upstream in the theme’s GitHub repository into core.

- Fixes some minor code quality issues. WordPress/twentynineteen#237
- Fix PHP Warning: Parameter must be an array or an object that implements Countable. WordPress/twentynineteen#661
- Add missing text domain and escaping to comment author text. WordPress/twentynineteen#274
- Remove hyphens rule for cover image text. WordPress/twentynineteen#691

Props khleomix, grapplerulrich, iCaleb, kjellr, allancole.

See #45424.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@44199 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Dec 14, 2018
1 parent 6ae98f3 commit 73894e6
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 67 deletions.
Expand Up @@ -33,36 +33,42 @@ protected function html5_comment( $comment, $depth, $args ) {
<footer class="comment-meta">
<div class="comment-author vcard">
<?php
$comment_author_link = get_comment_author_link( $comment );
$comment_author_url = get_comment_author_url( $comment );
$comment_author = get_comment_author( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
if ( 0 != $args['avatar_size'] ) {
if ( empty( $comment_author_url ) ) {
echo $avatar;
} else {
printf( '<a href="%s" rel="external nofollow" class="url">', $comment_author_url );
echo $avatar;
}
$comment_author_link = get_comment_author_link( $comment );
$comment_author_url = get_comment_author_url( $comment );
$comment_author = get_comment_author( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
if ( 0 != $args['avatar_size'] ) {
if ( empty( $comment_author_url ) ) {
echo $avatar;
} else {
printf( '<a href="%s" rel="external nofollow" class="url">', $comment_author_url );
echo $avatar;
}
}
/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
}

/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
}

printf(
/* translators: %s: comment author link */
printf(
/* translators: %s: comment author link */
wp_kses(
__( '%s <span class="screen-reader-text says">says:</span>', 'twentynineteen' ),
sprintf( '<span class="fn">%s</span>', $comment_author )
);
array(
'span' => array(
'class' => array(),
),
)
),
'<b class="fn">' . get_comment_author_link( $comment ) . '</b>'
);

if ( ! empty( $comment_author_url ) ) {
echo '</a>';
}
if ( ! empty( $comment_author_url ) ) {
echo '</a>';
}
?>
</div><!-- .comment-author -->

Expand Down
50 changes: 25 additions & 25 deletions src/wp-content/themes/twentynineteen/comments.php
Expand Up @@ -28,38 +28,38 @@
<div class="<?php echo $discussion->responses > 0 ? 'comments-title-wrap' : 'comments-title-wrap no-responses'; ?>">
<h2 class="comments-title">
<?php
if ( comments_open() ) {
if ( have_comments() ) {
_e( 'Join the Conversation', 'twentynineteen' );
} else {
_e( 'Leave a comment', 'twentynineteen' );
}
if ( comments_open() ) {
if ( have_comments() ) {
_e( 'Join the Conversation', 'twentynineteen' );
} else {
_e( 'Leave a comment', 'twentynineteen' );
}
} else {
if ( '1' == $discussion->responses ) {
/* translators: %s: post title */
printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
} else {
if ( '1' == $discussion->responses ) {
/* translators: %s: post title */
printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
} else {
printf(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s reply on &ldquo;%2$s&rdquo;',
'%1$s replies on &ldquo;%2$s&rdquo;',
$discussion->responses,
'comments title',
'twentynineteen'
),
number_format_i18n( $discussion->responses ),
get_the_title()
);
}
printf(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s reply on &ldquo;%2$s&rdquo;',
'%1$s replies on &ldquo;%2$s&rdquo;',
$discussion->responses,
'comments title',
'twentynineteen'
),
number_format_i18n( $discussion->responses ),
get_the_title()
);
}
}
?>
</h2><!-- .comments-title -->
<?php
// Only show discussion meta information when comments are open and available.
if ( have_comments() && comments_open() ) {
if ( have_comments() && comments_open() ) {
get_template_part( 'template-parts/post/discussion', 'meta' );
}
}
?>
</div><!-- .comments-title-flex -->
<?php
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentynineteen/header.php
Expand Up @@ -37,7 +37,7 @@
$discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;

$classes = 'entry-header';
if ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) {
if ( ! empty( $discussion ) && absint( $discussion->responses ) > 0 ) {
$classes = 'entry-header has-discussion';
}
?>
Expand Down
4 changes: 0 additions & 4 deletions src/wp-content/themes/twentynineteen/sass/blocks/_blocks.scss
Expand Up @@ -529,10 +529,6 @@
line-height: 1.25;
padding: 0;
color: #fff;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;

@include media(tablet) {
font-size: $font__size-xl;
Expand Down
4 changes: 0 additions & 4 deletions src/wp-content/themes/twentynineteen/style-rtl.css
Expand Up @@ -3968,10 +3968,6 @@ body.page .main-navigation {
line-height: 1.25;
padding: 0;
color: #fff;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}

@media only screen and (min-width: 768px) {
Expand Down
4 changes: 0 additions & 4 deletions src/wp-content/themes/twentynineteen/style.css
Expand Up @@ -3980,10 +3980,6 @@ body.page .main-navigation {
line-height: 1.25;
padding: 0;
color: #fff;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}

@media only screen and (min-width: 768px) {
Expand Down
Expand Up @@ -10,8 +10,15 @@
if ( (bool) get_the_author_meta( 'description' ) ) : ?>
<div class="author-bio">
<h2 class="author-title">
<?php /* translators: %s: author name */ ?>
<span class="author-heading"><?php echo esc_html( sprintf( __( 'Published by %s', 'twentynineteen' ), get_the_author() ) ); ?></span>
<span class="author-heading">
<?php
printf(
/* translators: %s: post author */
__( 'Published by %s', 'twentynineteen' ),
esc_html( get_the_author() )
);
?>
</span>
</h2>
<p class="author-description">
<?php the_author_meta( 'description' ); ?>
Expand Down
Expand Up @@ -17,7 +17,6 @@
} else {
$meta_label = __( 'No comments', 'twentynineteen' );
}

?>

<div class="discussion-meta">
Expand Down

0 comments on commit 73894e6

Please sign in to comment.