Advertisement
darrenbachan

Untitled

Jun 3rd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.89 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.         <h3 class="comments-title">
  29.             <?php
  30.                 printf( // WPCS: XSS OK.
  31.                     esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s comments 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.         </h3>
  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( 'type=comment&callback=mytheme_comment' );
  53.             ?>
  54.         </ol><!-- .comment-list -->
  55.  
  56.         <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  57.         <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  58.             <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'darren-bachan' ); ?></h2>
  59.             <div class="nav-links">
  60.  
  61.                 <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'darren-bachan' ) ); ?></div>
  62.                 <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'darren-bachan' ) ); ?></div>
  63.  
  64.             </div><!-- .nav-links -->
  65.         </nav><!-- #comment-nav-below -->
  66.         <?php
  67.         endif; // Check for comment navigation.
  68.  
  69.     endif; // Check for have_comments().
  70.  
  71.  
  72.     // If comments are closed and there are comments, let's leave a little note, shall we?
  73.     if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
  74.  
  75.         <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'darren-bachan' ); ?></p>
  76.     <?php
  77.     endif;
  78.  
  79.     comment_form();
  80.     ?>
  81.  
  82. </div><!-- #comments -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement