[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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                  /* translators: Hidden accessibility text. */
  72                  'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous', 'twentyseventeen' ) . '</span>',
  73                  /* translators: Hidden accessibility text. */
  74                  'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
  75              )
  76          );
  77  
  78      endif; // Check for have_comments().
  79  
  80      // If comments are closed and there are comments, let's leave a little note, shall we?
  81      if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  82          ?>
  83  
  84          <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyseventeen' ); ?></p>
  85          <?php
  86      endif;
  87  
  88      comment_form();
  89      ?>
  90  
  91  </div><!-- #comments -->


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref