[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentyseventeen/ -> comments.php (source)

   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://developer.wordpress.org/themes/basics/template-hierarchy/
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Seventeen
  12   * @since Twenty Seventeen 1.0
  13   * @version 1.0
  14   */
  15  
  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  
  26  <div id="comments" class="comments-area">
  27  
  28      <?php
  29      // You can start editing here -- including this comment!
  30      if ( have_comments() ) :
  31          ?>
  32          <h2 class="comments-title">
  33              <?php
  34              $comments_number = get_comments_number();
  35              if ( '1' === $comments_number ) {
  36                  /* translators: %s: Post title. */
  37                  printf( _x( 'One Reply to &ldquo;%s&rdquo;', 'comments title', 'twentyseventeen' ), get_the_title() );
  38              } else {
  39                  printf(
  40                      /* translators: 1: Number of comments, 2: Post title. */
  41                      _nx(
  42                          '%1$s Reply to &ldquo;%2$s&rdquo;',
  43                          '%1$s Replies to &ldquo;%2$s&rdquo;',
  44                          $comments_number,
  45                          'comments title',
  46                          'twentyseventeen'
  47                      ),
  48                      number_format_i18n( $comments_number ),
  49                      get_the_title()
  50                  );
  51              }
  52              ?>
  53          </h2>
  54  
  55          <ol class="comment-list">
  56              <?php
  57                  wp_list_comments(
  58                      array(
  59                          'avatar_size' => 100,
  60                          'style'       => 'ol',
  61                          'short_ping'  => true,
  62                          'reply_text'  => twentyseventeen_get_svg( array( 'icon' => 'mail-reply' ) ) . __( 'Reply', 'twentyseventeen' ),
  63                      )
  64                  );
  65              ?>
  66          </ol>
  67  
  68          <?php
  69          the_comments_pagination(
  70              array(
  71                  'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous', 'twentyseventeen' ) . '</span>',
  72                  'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
  73              )
  74          );
  75  
  76      endif; // Check for have_comments().
  77  
  78      // If comments are closed and there are comments, let's leave a little note, shall we?
  79      if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  80          ?>
  81  
  82          <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyseventeen' ); ?></p>
  83          <?php
  84      endif;
  85  
  86      comment_form();
  87      ?>
  88  
  89  </div><!-- #comments -->


Generated: Tue Apr 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1