[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentyfifteen/ -> 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_Fifteen
  10   * @since Twenty Fifteen 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', 'twentyfifteen' ), 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                          'twentyfifteen'
  41                      ),
  42                      number_format_i18n( $comments_number ),
  43                      get_the_title()
  44                  );
  45              }
  46              ?>
  47          </h2>
  48  
  49          <?php twentyfifteen_comment_nav(); ?>
  50  
  51          <ol class="comment-list">
  52              <?php
  53                  wp_list_comments(
  54                      array(
  55                          'style'       => 'ol',
  56                          'short_ping'  => true,
  57                          'avatar_size' => 56,
  58                      )
  59                  );
  60              ?>
  61          </ol><!-- .comment-list -->
  62  
  63          <?php twentyfifteen_comment_nav(); ?>
  64  
  65      <?php endif; // 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.', 'twentyfifteen' ); ?></p>
  72      <?php endif; ?>
  73  
  74      <?php comment_form(); ?>
  75  
  76  </div><!-- .comments-area -->


Generated : Sat Nov 23 08:20:01 2024 Cross-referenced by PHPXref