WordPress/wp-content/themes/twentytwentyone/comments.php
desrosj 3ea8930f37 Bundled Themes: Import Twenty Twenty-One, the new default theme for WordPress 5.6.
Welcome to the bundled themes family!

Twenty Twenty-One is a blank canvas for your ideas, making the block editor your best brush.

Theme development to this point has taken place on GitHub. See: https://github.com/WordPress/twentytwentyone/.

Props poena, melchoyce, luminuu, elmastudio, bethsoderberg, williampatton, aristath, jffng, kjellr, jeffikus, audrasjb, fabiankaegy, mukesh27, dingo_d, kellylawrence, acosmin, whyisjake, metodiew, ryelle, nielslange, littlebigthing, mahesh901122, zebulan, kishanjasani, lukecavanagh, scruffian, abhijitrakas, utz119, sudoshreyansh, kau-boy, justinahinon, joostdevalk, bduclos, hareesh-pillai, mager19, rolfsiebers, webmigrates, sresok, guidooffermans, francina, marybaum, hareshlive, navanathbhosale, afercia, richtabor, joyously, sarahricker, nrqsnchz, glauberglauber, sabernhardt, kraftbj, ItsJonQ, joen, CTMartin0, decrecementofeliz, bhautikvirani.
See #51526.
Built from https://develop.svn.wordpress.org/trunk@49216


git-svn-id: http://core.svn.wordpress.org/trunk@48978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 01:14:10 +00:00

96 lines
2.6 KiB
PHP

<?php
/**
* The template for displaying comments
*
* This is the template that displays the area of the page that contains both the current comments
* and the comment form.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Twenty_One
* @since 1.0.0
*/
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
$twenty_twenty_one_comment_count = get_comments_number();
?>
<div id="comments" class="comments-area default-max-width <?php echo get_option( 'show_avatars' ) ? 'show-avatars' : ''; ?>">
<?php
if ( have_comments() ) :
;
?>
<h2 class="comments-title">
<?php if ( '1' === $twenty_twenty_one_comment_count ) : ?>
<?php esc_html_e( '1 Reply', 'twentytwentyone' ); ?>
<?php else : ?>
<?php
printf(
/* translators: %s: comment count number. */
esc_html( _nx( '%s Reply', '%s Replies', $twenty_twenty_one_comment_count, 'comments title', 'twentytwentyone' ) ),
esc_html( number_format_i18n( $twenty_twenty_one_comment_count ) )
);
?>
<?php endif; ?>
</h2><!-- .comments-title -->
<ol class="comment-list">
<?php
wp_list_comments(
array(
'avatar_size' => 60,
'style' => 'ol',
'short_ping' => true,
)
);
?>
</ol><!-- .comment-list -->
<?php
the_comments_pagination(
array(
/* translators: There is a space after page. */
'before_page_number' => esc_html__( 'Page ', 'twentytwentyone' ),
'mid_size' => 0,
'prev_text' => sprintf(
'%s <span class="nav-prev-text">%s</span>',
is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
esc_html__( 'Older comments', 'twentytwentyone' )
),
'next_text' => sprintf(
'<span class="nav-next-text">%s</span> %s',
esc_html__( 'Newer comments', 'twentytwentyone' ),
is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' )
),
)
);
?>
<?php if ( ! comments_open() ) : ?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'twentytwentyone' ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php
comment_form(
array(
'logged_in_as' => null,
'title_reply' => esc_html__( 'Leave a reply', 'twentytwentyone' ),
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h2>',
)
);
?>
</div><!-- #comments -->