[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwentyone/ -> comments.php (source)

   1  <?php
   2  /**
   3   * The template for displaying comments
   4   *
   5   * This is the template that displays the area of the page that contains both the current comments
   6   * and the comment form.
   7   *
   8   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Twenty_One
  12   * @since Twenty Twenty-One 1.0
  13   */
  14  
  15  /*
  16   * If the current post is protected by a password and
  17   * the visitor has not yet entered the password,
  18   * return early without loading the comments.
  19   */
  20  if ( post_password_required() ) {
  21      return;
  22  }
  23  
  24  $twenty_twenty_one_comment_count = get_comments_number();
  25  ?>
  26  
  27  <div id="comments" class="comments-area default-max-width <?php echo get_option( 'show_avatars' ) ? 'show-avatars' : ''; ?>">
  28  
  29      <?php
  30      if ( have_comments() ) :
  31          ?>
  32          <h2 class="comments-title">
  33              <?php if ( '1' === $twenty_twenty_one_comment_count ) : ?>
  34                  <?php esc_html_e( '1 comment', 'twentytwentyone' ); ?>
  35              <?php else : ?>
  36                  <?php
  37                  printf(
  38                      /* translators: %s: Comment count number. */
  39                      esc_html( _nx( '%s comment', '%s comments', $twenty_twenty_one_comment_count, 'Comments title', 'twentytwentyone' ) ),
  40                      esc_html( number_format_i18n( $twenty_twenty_one_comment_count ) )
  41                  );
  42                  ?>
  43              <?php endif; ?>
  44          </h2><!-- .comments-title -->
  45  
  46          <ol class="comment-list">
  47              <?php
  48              wp_list_comments(
  49                  array(
  50                      'avatar_size' => 60,
  51                      'style'       => 'ol',
  52                      'short_ping'  => true,
  53                  )
  54              );
  55              ?>
  56          </ol><!-- .comment-list -->
  57  
  58          <?php
  59          the_comments_pagination(
  60              array(
  61                  'before_page_number' => esc_html__( 'Page', 'twentytwentyone' ) . ' ',
  62                  'mid_size'           => 0,
  63                  'prev_text'          => sprintf(
  64                      '%s <span class="nav-prev-text">%s</span>',
  65                      is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
  66                      esc_html__( 'Older comments', 'twentytwentyone' )
  67                  ),
  68                  'next_text'          => sprintf(
  69                      '<span class="nav-next-text">%s</span> %s',
  70                      esc_html__( 'Newer comments', 'twentytwentyone' ),
  71                      is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' )
  72                  ),
  73              )
  74          );
  75          ?>
  76  
  77          <?php if ( ! comments_open() ) : ?>
  78              <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'twentytwentyone' ); ?></p>
  79          <?php endif; ?>
  80      <?php endif; ?>
  81  
  82      <?php
  83      comment_form(
  84          array(
  85              'logged_in_as'       => null,
  86              'title_reply'        => esc_html__( 'Leave a comment', 'twentytwentyone' ),
  87              'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
  88              'title_reply_after'  => '</h2>',
  89          )
  90      );
  91      ?>
  92  
  93  </div><!-- #comments -->


Generated: Fri Oct 22 01:00:02 2021 Cross-referenced by PHPXref 0.7.1