wp/wp-content/themes/twentytwelve/comments.php
author ymh <ymh.work@gmail.com>
Wed, 06 Nov 2013 03:21:17 +0000
changeset 0 d970ebf37754
child 7 cf61fcea0001
permissions -rw-r--r--
first import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * The template for displaying Comments
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * The area of the page that contains both current comments
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * and the comment form. The actual display of comments is
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * handled by a callback to twentytwelve_comment() which is
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * located in the functions.php file.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * @subpackage Twenty_Twelve
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 * @since Twenty Twelve 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 * If the current post is protected by a password and
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 * the visitor has not yet entered the password we will
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 * return early without loading the comments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
if ( post_password_required() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
	return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
<div id="comments" class="comments-area">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
	<?php // You can start editing here -- including this comment! ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	<?php if ( have_comments() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
		<h2 class="comments-title">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
			<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
				printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
					number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
			?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
		</h2>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
		<ol class="commentlist">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
			<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
		</ol><!-- .commentlist -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
		<nav id="comment-nav-below" class="navigation" role="navigation">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
			<h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentytwelve' ) ); ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentytwelve' ) ); ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
		</nav>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
		<?php endif; // check for comment navigation ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
		<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
		/* If there are no comments and comments are closed, let's leave a note.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
		 * But we only want the note on posts and pages that had comments in the first place.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
		 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
		if ( ! comments_open() && get_comments_number() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
		<p class="nocomments"><?php _e( 'Comments are closed.' , 'twentytwelve' ); ?></p>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
		<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
	<?php endif; // have_comments() ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
	<?php comment_form(); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
</div><!-- #comments .comments-area -->