[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * 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 twentyeleven_comment() which is
   8   * located in the functions.php file.
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Eleven
  12   * @since Twenty Eleven 1.0
  13   */
  14  ?>
  15      <div id="comments">
  16      <?php if ( post_password_required() ) : ?>
  17          <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?></p>
  18      </div><!-- #comments -->
  19          <?php
  20              /*
  21               * Stop the rest of comments.php from being processed,
  22               * but don't kill the script entirely -- we still have
  23               * to fully load the template.
  24               */
  25              return;
  26          endif;
  27      ?>
  28  
  29      <?php // You can start editing here -- including this comment! ?>
  30  
  31      <?php if ( have_comments() ) : ?>
  32          <h2 id="comments-title">
  33              <?php
  34              if ( 1 === get_comments_number() ) {
  35                  printf(
  36                      /* translators: %s: The post title. */
  37                      __( 'One thought on &ldquo;%1$s&rdquo;', 'twentyeleven' ),
  38                      '<span>' . get_the_title() . '</span>'
  39                  );
  40              } else {
  41                  printf(
  42                      /* translators: 1: The number of comments, 2: The post title. */
  43                      _n( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyeleven' ),
  44                      number_format_i18n( get_comments_number() ),
  45                      '<span>' . get_the_title() . '</span>'
  46                  );
  47              }
  48              ?>
  49          </h2>
  50  
  51          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  52          <nav id="comment-nav-above">
  53              <h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
  54              <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
  55              <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
  56          </nav>
  57          <?php endif; // Check for comment navigation. ?>
  58  
  59          <ol class="commentlist">
  60              <?php
  61                  /*
  62                   * Loop through and list the comments. Tell wp_list_comments()
  63                   * to use twentyeleven_comment() to format the comments.
  64                   * If you want to overload this in a child theme then you can
  65                   * define twentyeleven_comment() and that will be used instead.
  66                   * See twentyeleven_comment() in twentyeleven/functions.php for more.
  67                   */
  68                  wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );
  69              ?>
  70          </ol>
  71  
  72          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  73          <nav id="comment-nav-below">
  74              <h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
  75              <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
  76              <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
  77          </nav>
  78          <?php endif; // Check for comment navigation. ?>
  79  
  80          <?php
  81          /*
  82           * If there are no comments and comments are closed, let's leave a little note, shall we?
  83           * But we only want the note on posts and pages that had comments in the first place.
  84           */
  85          if ( ! comments_open() && get_comments_number() ) :
  86              ?>
  87          <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>
  88          <?php endif; ?>
  89  
  90      <?php endif; // have_comments() ?>
  91  
  92      <?php comment_form(); ?>
  93  
  94  </div><!-- #comments -->


Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1