[ XREF Home ] [ Index ]

PHP Cross Reference of WordPress Trunk

Provided by Yoast

title

Body

[close]

/wp-content/themes/twentyeleven/ -> 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 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              /* Stop the rest of comments.php from being processed,
  21               * but don't kill the script entirely -- we still have
  22               * to fully load the template.
  23               */
  24              return;
  25          endif;
  26      ?>
  27  
  28      <?php // You can start editing here -- including this comment! ?>
  29  
  30      <?php if ( have_comments() ) : ?>
  31          <h2 id="comments-title">
  32              <?php
  33                  printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyeleven' ),
  34                      number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  35              ?>
  36          </h2>
  37  
  38          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  39          <nav id="comment-nav-above">
  40              <h1 class="section-heading"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
  41              <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
  42              <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
  43          </nav>
  44          <?php endif; // check for comment navigation ?>
  45  
  46          <ol class="commentlist">
  47              <?php
  48                  /* Loop through and list the comments. Tell wp_list_comments()
  49                   * to use twentyeleven_comment() to format the comments.
  50                   * If you want to overload this in a child theme then you can
  51                   * define twentyeleven_comment() and that will be used instead.
  52                   * See twentyeleven_comment() in twentyeleven/functions.php for more.
  53                   */
  54                  wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );
  55              ?>
  56          </ol>
  57  
  58          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  59          <nav id="comment-nav-below">
  60              <h1 class="section-heading"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
  61              <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
  62              <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
  63          </nav>
  64          <?php endif; // check for comment navigation ?>
  65  
  66      <?php else : // this is displayed if there are no comments so far ?>
  67  
  68          <?php if ( comments_open() ) : // If comments are open, but there are no comments ?>
  69  
  70          <?php else : // or, if we don't have comments:
  71  
  72              /* If there are no comments and comments are closed,
  73               * let's leave a little note, shall we?
  74               * But only on posts! We don't want the note on pages.
  75               */
  76              if ( ! comments_open() && ! is_page() ) :
  77              ?>
  78              <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>
  79              <?php endif; // end ! comments_open() && ! is_page() ?>
  80  
  81  
  82          <?php endif; ?>
  83  
  84      <?php endif; ?>
  85  
  86      <?php comment_form(); ?>
  87  
  88  </div><!-- #comments -->


Generated: Wed Jun 1 08:30:02 2011 Cross-referenced by PHPXref 0.7
Provided by Yoast and awesome WordPress Hosting