Make WordPress Core


Ignore:
Timestamp:
08/14/2013 04:38:01 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: first pass at matching code standards achieved with Twenty Thirteen development. See #24858, props obenland.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/comments.php

    r24832 r25021  
    33 * The template for displaying Comments.
    44 *
    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 twentyfourteen_comment() which is
    8  * located in the functions.php file.
     5 * The area of the page that contains comments and the comment form.
    96 *
    107 * @package WordPress
    118 * @subpackage Twenty_Fourteen
    129 */
     10
     11/*
     12 * If the current post is protected by a password and the visitor has not yet
     13 * entered the password we will return early without loading the comments.
     14 */
     15if ( post_password_required() )
     16    return;
    1317?>
    1418
    15 <?php
    16     /*
    17      * If the current post is protected by a password and
    18      * the visitor has not yet entered the password we will
    19      * return early without loading the comments.
    20      */
    21     if ( post_password_required() )
    22         return;
    23 ?>
    24 
    25     <div id="comments" class="comments-area">
    26 
    27     <?php // You can start editing here -- including this comment! ?>
     19<div id="comments" class="comments-area">
    2820
    2921    <?php if ( have_comments() ) : ?>
    30         <h2 class="comments-title">
    31             <?php
    32                 printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyfourteen' ),
    33                     number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
    34             ?>
    35         </h2>
    3622
    37         <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
    38         <nav role="navigation" id="comment-nav-above" class="site-navigation comment-navigation clearfix">
    39             <h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
    40             <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
    41             <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
    42         </nav><!-- #comment-nav-above .site-navigation .comment-navigation -->
    43         <?php endif; // check for comment navigation ?>
     23    <h2 class="comments-title">
     24        <?php
     25            printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyfourteen' ),
     26                number_format_i18n( get_comments_number() ), get_the_title() );
     27        ?>
     28    </h2>
    4429
    45         <ol class="commentlist">
    46             <?php
    47                 /* Loop through and list the comments. Tell wp_list_comments()
    48                  * to use twentyfourteen_comment() to format the comments.
    49                  * If you want to overload this in a child theme then you can
    50                  * define twentyfourteen_comment() and that will be used instead.
    51                  * See twentyfourteen_comment() in inc/template-tags.php for more.
    52                  */
    53                 wp_list_comments( array( 'callback' => 'twentyfourteen_comment' ) );
    54             ?>
    55         </ol><!-- .commentlist -->
     30    <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
     31    <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
     32        <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
     33        <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
     34        <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
     35    </nav><!-- #comment-nav-above -->
     36    <?php endif; // Check for comment navigation. ?>
    5637
    57         <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
    58         <nav role="navigation" id="comment-nav-below" class="site-navigation comment-navigation clearfix">
    59             <h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
    60             <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
    61             <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
    62         </nav><!-- #comment-nav-below .site-navigation .comment-navigation -->
    63         <?php endif; // check for comment navigation ?>
     38    <ol class="comment-list">
     39        <?php
     40            wp_list_comments( array(
     41                'style'      => 'ol',
     42                'short_ping' => true,
     43
     44                // TODO: Remove callback and update styles.
     45                'callback'=>'twentyfourteen_comment',
     46            ) );
     47        ?>
     48    </ol><!-- .comment-list -->
     49
     50    <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
     51    <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
     52        <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
     53        <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
     54        <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
     55    </nav><!-- #comment-nav-below -->
     56    <?php endif; // Check for comment navigation. ?>
     57
     58    <?php if ( ! comments_open() ) : ?>
     59    <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyfourteen' ); ?></p>
     60    <?php endif; ?>
    6461
    6562    <?php endif; // have_comments() ?>
    6663
    67     <?php
    68         // If comments are closed and there are comments, let's leave a little note, shall we?
    69         if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
    70     ?>
    71         <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyfourteen' ); ?></p>
    72     <?php endif; ?>
    73 
    7464    <?php comment_form(); ?>
    7565
    76 </div><!-- #comments .comments-area -->
     66</div><!-- #comments -->
Note: See TracChangeset for help on using the changeset viewer.