123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?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 Pen
- */
- /**
- * 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">
- <?php
- if ( have_comments() ) {
- ?>
- <h2 class="comments-title">
- <?php
- $pen_comment_count = get_comments_number();
- if ( '1' === $pen_comment_count ) {
- printf(
- /* Translators: 1: title. */
- esc_html__( 'One thought on “%1$s”', 'pen' ),
- '<span>' . get_the_title() . '</span>'
- );
- } else {
- printf( /* phpcs:ignore */
- /* Translators: %1$s: comment count number, %2$s: title. */
- esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $pen_comment_count, 'comments title', 'pen' ) ),
- number_format_i18n( $pen_comment_count ),
- '<span>' . get_the_title() . '</span>'
- );
- }
- ?>
- </h2>
- <?php
- /* Are there comments to navigate through? */
- if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) {
- ?>
- <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Top Comments Menu', 'pen' ); ?>">
- <h2 class="screen-reader-text">
- <?php
- esc_html_e( 'Comment navigation', 'pen' );
- ?>
- </h2>
- <div class="nav-links">
- <div class="nav-previous">
- <?php
- previous_comments_link( esc_html__( 'Older Comments', 'pen' ) );
- ?>
- </div>
- <div class="nav-next">
- <?php
- next_comments_link( esc_html__( 'Newer Comments', 'pen' ) );
- ?>
- </div>
- </div><!-- .nav-links -->
- </nav><!-- #comment-nav-above -->
- <?php
- }
- ?>
- <ol class="comment-list">
- <?php
- wp_list_comments(
- array(
- 'style' => 'ol',
- 'short_ping' => true,
- )
- );
- ?>
- </ol><!-- .comment-list -->
- <?php
- /* Are there comments to navigate through? */
- if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) {
- ?>
- <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Bottom Comments Menu', 'pen' ); ?>">
- <h2 class="screen-reader-text">
- <?php
- esc_html_e( 'Comment navigation', 'pen' );
- ?>
- </h2>
- <div class="nav-links">
- <div class="nav-previous">
- <?php
- previous_comments_link( esc_html__( 'Older Comments', 'pen' ) );
- ?>
- </div>
- <div class="nav-next">
- <?php
- next_comments_link( esc_html__( 'Newer Comments', 'pen' ) );
- ?>
- </div>
- </div><!-- .nav-links -->
- </nav><!-- #comment-nav-below -->
- <?php
- }
- }
- /* If comments are closed and there are comments, let's leave a little note, shall we? */
- if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) {
- ?>
- <p class="no-comments">
- <?php
- esc_html_e( 'Comments are closed.', 'pen' );
- ?>
- </p>
- <?php
- }
- ?>
- <div id="pen_respond_wrapper" class="<?php pen_class_animation( 'comments' ); /* phpcs:ignore */ ?>">
- <?php
- $fields=array(
- 'author' => '<p class="comment-form-author">' . '<label for="author">姓名/联系方式:</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
- '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="50"' . $aria_req . ' /></p>',
- 'email' => '',
- 'url' => "",
- );
- $defaults=array(
- 'fields'=> apply_filters( 'comment_form_default_fields', $fields ),
- );
- comment_form($defaults);
- ?>
- </div>
- </div><!-- #comments -->
|