[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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


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