Update comments.php

This commit is contained in:
IanDelMar 2018-11-18 21:25:27 +01:00
parent 51c5f93019
commit d979bf8a5a
1 changed files with 53 additions and 45 deletions

View File

@ -29,46 +29,49 @@ if ( post_password_required() ) {
<?php if ( have_comments() ) : ?> <?php if ( have_comments() ) : ?>
<h2 class="comments-title"> <h2 class="comments-title">
<?php <?php
$comments_number = get_comments_number(); $comments_number = get_comments_number();
if ( 1 === (int)$comments_number ) { if ( 1 === (int) $comments_number ) {
printf( printf(
/* translators: %s: post title */ /* translators: %s: post title */
esc_html_x( 'One thought on &ldquo;%s&rdquo;', 'comments title', 'understrap' ), esc_html_x( 'One thought on &ldquo;%s&rdquo;', 'comments title', 'understrap' ),
'<span>' . get_the_title() . '</span>' '<span>' . get_the_title() . '</span>'
); );
} else { } else {
printf( // WPCS: XSS OK. printf( // WPCS: XSS OK.
/* translators: 1: number of comments, 2: post title */ /* translators: 1: number of comments, 2: post title */
esc_html( _nx( esc_html( _nx(
'%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thought on &ldquo;%2$s&rdquo;',
'%1$s thoughts on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;',
$comments_number, $comments_number,
'comments title', 'comments title',
'understrap' 'understrap'
) ), ) ),
number_format_i18n( $comments_number ), number_format_i18n( $comments_number ),
'<span>' . get_the_title() . '</span>' '<span>' . get_the_title() . '</span>'
); );
} }
?> ?>
</h2><!-- .comments-title --> </h2><!-- .comments-title -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?>
<nav class="comment-navigation" id="comment-nav-above"> <nav class="comment-navigation" id="comment-nav-above">
<h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'understrap' ); ?></h1> <h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'understrap' ); ?></h1>
<?php if ( get_previous_comments_link() ) { ?> <?php if ( get_previous_comments_link() ) { ?>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', <div class="nav-previous">
'understrap' ) ); ?></div> <?php previous_comments_link( __( '&larr; Older Comments','understrap' ) ); ?>
<?php } </div>
if ( get_next_comments_link() ) { ?> <?php } ?>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;',
'understrap' ) ); ?></div> <?php if ( get_next_comments_link() ) { ?>
<div class="nav-next">
<?php next_comments_link( __( 'Newer Comments &rarr;', 'understrap' ) ); ?>
</div>
<?php } ?> <?php } ?>
</nav><!-- #comment-nav-above --> </nav><!-- #comment-nav-above -->
@ -78,31 +81,36 @@ if ( post_password_required() ) {
<ol class="comment-list"> <ol class="comment-list">
<?php <?php
wp_list_comments( array( wp_list_comments(
'style' => 'ol', array(
'short_ping' => true, 'style' => 'ol',
) ); 'short_ping' => true,
)
);
?> ?>
</ol><!-- .comment-list --> </ol><!-- .comment-list -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?>
<nav class="comment-navigation" id="comment-nav-below"> <nav class="comment-navigation" id="comment-nav-below">
<h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'understrap' ); ?></h1> <h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'understrap' ); ?></h1>
<?php if ( get_previous_comments_link() ) { ?> <?php if ( get_previous_comments_link() ) { ?>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', <div class="nav-previous">
'understrap' ) ); ?></div> <?php previous_comments_link( __( '&larr; Older Comments', 'understrap' ) ); ?>
<?php } </div>
if ( get_next_comments_link() ) { ?> <?php } ?>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;',
'understrap' ) ); ?></div> <?php if ( get_next_comments_link() ) { ?>
<div class="nav-next">
<?php next_comments_link( __( 'Newer Comments &rarr;', 'understrap' ) ); ?>
</div>
<?php } ?> <?php } ?>
</nav><!-- #comment-nav-below --> </nav><!-- #comment-nav-below -->
<?php endif; // check for comment navigation. ?> <?php endif; // check for comment navigation. ?>
<?php endif; // endif have_comments(). ?> <?php endif; // endif have_comments(). ?>