forked from mirror/_s
Fix translatability of comments title.
As per the guidelines in https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals This fixes an error notice which WPCS will start throwing once the - soon to be released - 0.10.0 version has become stable.
This commit is contained in:
parent
9700947f74
commit
8dbca77003
18
comments.php
18
comments.php
|
@ -27,11 +27,19 @@ if ( post_password_required() ) {
|
|||
if ( have_comments() ) : ?>
|
||||
<h2 class="comments-title">
|
||||
<?php
|
||||
printf( // WPCS: XSS OK.
|
||||
esc_html( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', '_s' ) ),
|
||||
number_format_i18n( get_comments_number() ),
|
||||
'<span>' . get_the_title() . '</span>'
|
||||
);
|
||||
$comment_count = get_comments_number();
|
||||
if ( 1 === $comment_count ) {
|
||||
printf(
|
||||
esc_html_e( 'One thought on “%1$s”', '_s' ),
|
||||
'<span>' . get_the_title() . '</span>'
|
||||
);
|
||||
} else {
|
||||
printf( // WPCS: XSS OK.
|
||||
esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', '_s' ) ),
|
||||
number_format_i18n( $comment_count ),
|
||||
'<span>' . get_the_title() . '</span>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</h2><!-- .comments-title -->
|
||||
|
||||
|
|
Reference in New Issue