[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentytwelve/ -> 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. The actual display of comments is
   7   * handled by a callback to twentytwelve_comment() which is
   8   * located in the functions.php file.
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Twelve
  12   * @since Twenty Twelve 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 we will
  18   * return early without loading the comments.
  19   */
  20  if ( post_password_required() ) {
  21      return;
  22  }
  23  ?>
  24  
  25  <div id="comments" class="comments-area">
  26  
  27      <?php // You can start editing here -- including this comment! ?>
  28  
  29      <?php if ( have_comments() ) : ?>
  30          <h2 class="comments-title">
  31              <?php
  32              if ( '1' === get_comments_number() ) {
  33                  printf(
  34                      /* translators: %s: The post title. */
  35                      __( 'One thought on &ldquo;%s&rdquo;', 'twentytwelve' ),
  36                      '<span>' . get_the_title() . '</span>'
  37                  );
  38              } else {
  39                  printf(
  40                      /* translators: 1: The number of comments, 2: The post title. */
  41                      _n( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
  42                      number_format_i18n( get_comments_number() ),
  43                      '<span>' . get_the_title() . '</span>'
  44                  );
  45              }
  46              ?>
  47          </h2>
  48  
  49          <ol class="commentlist">
  50              <?php
  51              wp_list_comments(
  52                  array(
  53                      'callback' => 'twentytwelve_comment',
  54                      'style'    => 'ol',
  55                  )
  56              );
  57              ?>
  58          </ol><!-- .commentlist -->
  59  
  60          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  61          <nav id="comment-nav-below" class="navigation">
  62              <h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1>
  63              <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentytwelve' ) ); ?></div>
  64              <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentytwelve' ) ); ?></div>
  65          </nav>
  66          <?php endif; // Check for comment navigation. ?>
  67  
  68          <?php
  69          /*
  70           * If there are no comments and comments are closed, let's leave a note.
  71           * But we only want the note on posts and pages that had comments in the first place.
  72           */
  73          if ( ! comments_open() && get_comments_number() ) :
  74              ?>
  75          <p class="nocomments"><?php _e( 'Comments are closed.', 'twentytwelve' ); ?></p>
  76          <?php endif; ?>
  77  
  78      <?php endif; // have_comments() ?>
  79  
  80      <?php comment_form(); ?>
  81  
  82  </div><!-- #comments .comments-area -->


Generated : Fri Apr 19 08:20:01 2024 Cross-referenced by PHPXref