This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
_s/comments.php

78 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2012-01-07 03:25:13 +00:00
<?php
/**
2016-09-27 06:20:40 +00:00
* The template for displaying comments
2012-01-07 03:25:13 +00:00
*
* This is the template that displays the area of the page that contains both the current comments
* and the comment form.
2012-01-07 03:25:13 +00:00
*
2017-10-29 08:51:29 +00:00
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
2012-01-07 03:25:13 +00:00
* @package _s
*/
/*
* 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;
}
?>
<div id="comments" class="comments-area">
2012-01-07 03:25:13 +00:00
<?php
// You can start editing here -- including this comment!
if ( have_comments() ) :
?>
<h2 class="comments-title">
2012-01-07 03:25:13 +00:00
<?php
$_s_comment_count = get_comments_number();
if ( '1' === $_s_comment_count ) {
2017-06-28 01:27:25 +00:00
printf(
/* translators: 1: title. */
esc_html__( 'One thought on &ldquo;%1$s&rdquo;', '_s' ),
'<span>' . wp_kses_post( get_the_title() ) . '</span>'
2017-06-28 01:27:25 +00:00
);
} else {
2020-04-05 20:49:27 +00:00
printf(
2017-06-28 01:27:25 +00:00
/* translators: 1: comment count number, 2: title. */
esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $_s_comment_count, 'comments title', '_s' ) ),
2020-04-05 20:49:27 +00:00
number_format_i18n( $_s_comment_count ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'<span>' . wp_kses_post( get_the_title() ) . '</span>'
2017-06-28 01:27:25 +00:00
);
}
2012-01-07 03:25:13 +00:00
?>
2016-08-17 02:24:36 +00:00
</h2><!-- .comments-title -->
2012-01-07 03:25:13 +00:00
2015-12-07 17:02:25 +00:00
<?php the_comments_navigation(); ?>
2012-01-07 03:25:13 +00:00
<ol class="comment-list">
2013-12-23 23:26:50 +00:00
<?php
2020-04-05 20:49:27 +00:00
wp_list_comments(
array(
'style' => 'ol',
'short_ping' => true,
)
);
2013-12-23 23:26:50 +00:00
?>
</ol><!-- .comment-list -->
2012-01-07 03:25:13 +00:00
<?php
the_comments_navigation();
2012-01-07 03:25:13 +00:00
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() ) :
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', '_s' ); ?></p>
<?php
endif;
2012-01-07 03:25:13 +00:00
endif; // Check for have_comments().
2012-01-07 03:25:13 +00:00
comment_form();
?>
2012-01-07 03:25:13 +00:00
</div><!-- #comments -->