| 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 Astra |
|---|
| 11 | * @since 1.0.0 |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | /* |
|---|
| 15 | * If the current post is protected by a password and |
|---|
| 16 | * the visitor has not yet entered the password we will |
|---|
| 17 | * return early without loading the comments. |
|---|
| 18 | */ |
|---|
| 19 | if ( post_password_required() ) { |
|---|
| 20 | return; |
|---|
| 21 | } |
|---|
| 22 | ?> |
|---|
| 23 | |
|---|
| 24 | <div id="comments" class="comments-area"> |
|---|
| 25 | |
|---|
| 26 | <?php astra_comments_before(); ?> |
|---|
| 27 | |
|---|
| 28 | <?php if ( have_comments() ) : ?> |
|---|
| 29 | <div class="comments-count-wrapper"> |
|---|
| 30 | <h3 class="comments-title"> |
|---|
| 31 | <?php |
|---|
| 32 | printf( // WPCS: XSS OK. |
|---|
| 33 | /* translators: 1: number of comments */ |
|---|
| 34 | esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'astra' ) ), |
|---|
| 35 | number_format_i18n( get_comments_number() ), get_the_title() |
|---|
| 36 | ); |
|---|
| 37 | ?> |
|---|
| 38 | </h3> |
|---|
| 39 | </div> |
|---|
| 40 | |
|---|
| 41 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> |
|---|
| 42 | <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation" aria-label="<?php esc_html_e( 'Comments Navigation', 'astra' ); ?>"> |
|---|
| 43 | <h3 class="screen-reader-text"><?php echo esc_html( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></h3> |
|---|
| 44 | <div class="nav-links"> |
|---|
| 45 | |
|---|
| 46 | <div class="nav-previous"><?php previous_comments_link( astra_default_strings( 'string-comment-navigation-previous', false ) ); ?></div> |
|---|
| 47 | <div class="nav-next"><?php next_comments_link( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></div> |
|---|
| 48 | |
|---|
| 49 | </div><!-- .nav-links --> |
|---|
| 50 | </nav><!-- #comment-nav-above --> |
|---|
| 51 | <?php endif; ?> |
|---|
| 52 | |
|---|
| 53 | <ol class="ast-comment-list"> |
|---|
| 54 | <?php |
|---|
| 55 | wp_list_comments( |
|---|
| 56 | array( |
|---|
| 57 | 'callback' => 'astra_theme_comment', |
|---|
| 58 | 'style' => 'ol', |
|---|
| 59 | ) |
|---|
| 60 | ); |
|---|
| 61 | ?> |
|---|
| 62 | </ol><!-- .ast-comment-list --> |
|---|
| 63 | |
|---|
| 64 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> |
|---|
| 65 | <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation" aria-label="<?php esc_html_e( 'Comments Navigation', 'astra' ); ?>"> |
|---|
| 66 | <h3 class="screen-reader-text"><?php echo esc_html( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></h3> |
|---|
| 67 | <div class="nav-links"> |
|---|
| 68 | |
|---|
| 69 | <div class="nav-previous"><?php previous_comments_link( astra_default_strings( 'string-comment-navigation-previous', false ) ); ?></div> |
|---|
| 70 | <div class="nav-next"><?php next_comments_link( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></div> |
|---|
| 71 | |
|---|
| 72 | </div><!-- .nav-links --> |
|---|
| 73 | </nav><!-- #comment-nav-below --> |
|---|
| 74 | <?php endif; ?> |
|---|
| 75 | |
|---|
| 76 | <?php endif; ?> |
|---|
| 77 | |
|---|
| 78 | <?php |
|---|
| 79 | // If comments are closed and there are comments, let's leave a little note, shall we? |
|---|
| 80 | if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : |
|---|
| 81 | ?> |
|---|
| 82 | <p class="no-comments"><?php echo esc_html( astra_default_strings( 'string-comment-closed', false ) ); ?></p> |
|---|
| 83 | <?php endif; ?> |
|---|
| 84 | |
|---|
| 85 | <?php comment_form(); ?> |
|---|
| 86 | |
|---|
| 87 | <?php astra_comments_after(); ?> |
|---|
| 88 | |
|---|
| 89 | </div><!-- #comments --> |
|---|