storefront/comments.php

75 lines
2.9 KiB
PHP
Raw Normal View History

2014-08-17 16:55:38 +01:00
<?php
/**
* The template for displaying comments.
*
* The area of the page that contains both current comments
* and the comment form.
*
* @package storefront
*/
/*
* 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;
}
?>
2017-06-23 13:07:47 +03:00
<section id="comments" class="comments-area" aria-label="<?php esc_html_e( 'Post Comments', 'storefront' ); ?>">
2014-08-17 16:55:38 +01:00
2016-02-19 16:57:56 +00:00
<?php
if ( have_comments() ) : ?>
2014-08-17 16:55:38 +01:00
<h2 class="comments-title">
<?php
2016-08-01 11:17:10 +01:00
printf( // WPCS: XSS OK.
esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'storefront' ) ),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
2014-08-17 16:55:38 +01:00
?>
</h2>
2016-08-01 11:17:10 +01:00
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through. ?>
2017-06-23 13:07:47 +03:00
<nav id="comment-nav-above" class="comment-navigation" role="navigation" aria-label="<?php esc_html_e( 'Comment Navigation Above', 'storefront' ); ?>">
2016-08-01 11:17:10 +01:00
<span class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'storefront' ); ?></span>
2014-08-17 16:55:38 +01:00
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'storefront' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'storefront' ) ); ?></div>
</nav><!-- #comment-nav-above -->
2016-08-01 11:17:10 +01:00
<?php endif; // Check for comment navigation. ?>
2014-08-17 16:55:38 +01:00
<ol class="comment-list">
<?php
wp_list_comments( array(
2017-06-23 13:07:47 +03:00
'style' => 'ol',
'short_ping' => true,
'callback' => 'storefront_comment',
2014-08-17 16:55:38 +01:00
) );
?>
</ol><!-- .comment-list -->
2016-08-01 11:17:10 +01:00
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through. ?>
2017-06-23 13:07:47 +03:00
<nav id="comment-nav-below" class="comment-navigation" role="navigation" aria-label="<?php esc_html_e( 'Comment Navigation Below', 'storefront' ); ?>">
2016-08-01 11:17:10 +01:00
<span class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'storefront' ); ?></span>
2014-08-17 16:55:38 +01:00
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'storefront' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'storefront' ) ); ?></div>
</nav><!-- #comment-nav-below -->
2016-08-01 11:17:10 +01:00
<?php endif; // Check for comment navigation.
2014-08-17 16:55:38 +01:00
2016-08-01 11:17:10 +01:00
endif;
2014-08-17 16:55:38 +01:00
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
2016-08-01 11:17:10 +01:00
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'storefront' ); ?></p>
<?php endif;
2014-08-17 16:55:38 +01:00
2016-08-01 11:17:10 +01:00
$args = apply_filters( 'storefront_comment_form_args', array(
'title_reply_before' => '<span id="reply-title" class="gamma comment-reply-title">',
'title_reply_after' => '</span>',
) );
2014-08-17 16:55:38 +01:00
2016-07-27 19:40:14 +02:00
comment_form( $args ); ?>
</section><!-- #comments -->