web/wp-content/themes/twentytwelve/comments.php
changeset 204 09a1c134465b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
       
     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 <div id="comments" class="comments-area">
       
    25 
       
    26 	<?php // You can start editing here -- including this comment! ?>
       
    27 
       
    28 	<?php if ( have_comments() ) : ?>
       
    29 		<h2 class="comments-title">
       
    30 			<?php
       
    31 				printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
       
    32 					number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
       
    33 			?>
       
    34 		</h2>
       
    35 
       
    36 		<ol class="commentlist">
       
    37 			<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?>
       
    38 		</ol><!-- .commentlist -->
       
    39 
       
    40 		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
       
    41 		<nav id="comment-nav-below" class="navigation" role="navigation">
       
    42 			<h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1>
       
    43 			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentytwelve' ) ); ?></div>
       
    44 			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentytwelve' ) ); ?></div>
       
    45 		</nav>
       
    46 		<?php endif; // check for comment navigation ?>
       
    47 
       
    48 		<?php
       
    49 		/* If there are no comments and comments are closed, let's leave a note.
       
    50 		 * But we only want the note on posts and pages that had comments in the first place.
       
    51 		 */
       
    52 		if ( ! comments_open() && get_comments_number() ) : ?>
       
    53 		<p class="nocomments"><?php _e( 'Comments are closed.' , 'twentytwelve' ); ?></p>
       
    54 		<?php endif; ?>
       
    55 
       
    56 	<?php endif; // have_comments() ?>
       
    57 
       
    58 	<?php comment_form(); ?>
       
    59 
       
    60 </div><!-- #comments .comments-area -->