Advertisement
darrenbachan

Untitled

Jun 1st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.92 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying comments.
  4.  *
  5.  * This is the template that displays the area of the page that contains both the current comments
  6.  * and the comment form.
  7.  *
  8.  * @link https://codex.wordpress.org/Template_Hierarchy
  9.  *
  10.  * @package Darren_Bachan
  11.  */
  12.  
  13. /*
  14.  * If the current post is protected by a password and
  15.  * the visitor has not yet entered the password we will
  16.  * return early without loading the comments.
  17.  */
  18. if ( post_password_required() ) {
  19.     return;
  20. }
  21. ?>
  22.  
  23. <div id="comments" class="comments-area">
  24.  
  25.     <?php
  26.     // You can start editing here -- including this comment!
  27.     if ( have_comments() ) : ?>
  28.         <h2 class="comments-title">
  29.             <?php
  30.                 printf( // WPCS: XSS OK.
  31.                     esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'darren-bachan' ) ),
  32.                     number_format_i18n( get_comments_number() ),
  33.                     '<span>' . get_the_title() . '</span>'
  34.                 );
  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" class="navigation comment-navigation" role="navigation">
  40.             <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'darren-bachan' ); ?></h2>
  41.             <div class="nav-links">
  42.  
  43.                 <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'darren-bachan' ) ); ?></div>
  44.                 <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'darren-bachan' ) ); ?></div>
  45.  
  46.             </div><!-- .nav-links -->
  47.         </nav><!-- #comment-nav-above -->
  48.         <?php endif; // Check for comment navigation. ?>
  49.  
  50.         <ol class="comment-list">
  51.             <?php
  52.                 wp_list_comments( array(
  53.                     'style'      => 'ol',
  54.                     'short_ping' => true,
  55.                 ) );
  56.             ?>
  57.         </ol><!-- .comment-list -->
  58.  
  59.         <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  60.         <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  61.             <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'darren-bachan' ); ?></h2>
  62.             <div class="nav-links">
  63.  
  64.                 <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'darren-bachan' ) ); ?></div>
  65.                 <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'darren-bachan' ) ); ?></div>
  66.  
  67.             </div><!-- .nav-links -->
  68.         </nav><!-- #comment-nav-below -->
  69.         <?php
  70.         endif; // Check for comment navigation.
  71.  
  72.     endif; // Check for have_comments().
  73.  
  74.  
  75.     // If comments are closed and there are comments, let's leave a little note, shall we?
  76.     if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
  77.  
  78.         <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'darren-bachan' ); ?></p>
  79.     <?php
  80.     endif;
  81.  
  82.     comment_form();
  83.     ?>
  84.  
  85. </div><!-- #comments -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement