[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * The template for displaying comments
   4   *
   5   * The area of the page that contains both current comments
   6   * and the comment form.
   7   *
   8   * @package WordPress
   9   * @subpackage Twenty_Sixteen
  10   * @since Twenty Sixteen 1.0
  11   */
  12  
  13  /*
  14   * If the current post is protected by a password and
  15   * the visitor has not yet entered the password we will
  16   * return early without loading the comments.
  17   */
  18  if ( post_password_required() ) {
  19      return;
  20  }
  21  ?>
  22  
  23  <div id="comments" class="comments-area">
  24  
  25      <?php if ( have_comments() ) : ?>
  26          <h2 class="comments-title">
  27              <?php
  28                  $comments_number = get_comments_number();
  29              if ( '1' === $comments_number ) {
  30                  /* translators: %s: Post title. */
  31                  printf( _x( 'One thought on &ldquo;%s&rdquo;', 'comments title', 'twentysixteen' ), get_the_title() );
  32              } else {
  33                  printf(
  34                      /* translators: 1: Number of comments, 2: Post title. */
  35                      _nx(
  36                          '%1$s thought on &ldquo;%2$s&rdquo;',
  37                          '%1$s thoughts on &ldquo;%2$s&rdquo;',
  38                          $comments_number,
  39                          'comments title',
  40                          'twentysixteen'
  41                      ),
  42                      number_format_i18n( $comments_number ),
  43                      get_the_title()
  44                  );
  45              }
  46              ?>
  47          </h2>
  48  
  49          <?php the_comments_navigation(); ?>
  50  
  51          <ol class="comment-list">
  52              <?php
  53                  wp_list_comments(
  54                      array(
  55                          'style'       => 'ol',
  56                          'short_ping'  => true,
  57                          'avatar_size' => 42,
  58                      )
  59                  );
  60              ?>
  61          </ol><!-- .comment-list -->
  62  
  63          <?php the_comments_navigation(); ?>
  64  
  65      <?php endif; // Check for have_comments(). ?>
  66  
  67      <?php
  68          // If comments are closed and there are comments, let's leave a little note, shall we?
  69      if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  70          ?>
  71      <p class="no-comments"><?php _e( 'Comments are closed.', 'twentysixteen' ); ?></p>
  72      <?php endif; ?>
  73  
  74      <?php
  75          comment_form(
  76              array(
  77                  'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
  78                  'title_reply_after'  => '</h2>',
  79              )
  80          );
  81          ?>
  82  
  83  </div><!-- .comments-area -->


Generated: Fri Apr 19 01:00:02 2024 Cross-referenced by PHPXref 0.7.1