|
| 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 ASP_Theme |
| 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 | + ?> |
| 29 | + <h2 class="comments-title"> |
| 30 | + <?php |
| 31 | + $asp_theme_comment_count = get_comments_number(); |
| 32 | + if ( '1' === $asp_theme_comment_count ) { |
| 33 | + printf( |
| 34 | + /* translators: 1: title. */ |
| 35 | + esc_html__( 'One thought on “%1$s”', 'asp-theme' ), |
| 36 | + '<span>' . get_the_title() . '</span>' |
| 37 | + ); |
| 38 | + } else { |
| 39 | + printf( // WPCS: XSS OK. |
| 40 | + /* translators: 1: comment count number, 2: title. */ |
| 41 | + esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $asp_theme_comment_count, 'comments title', 'asp-theme' ) ), |
| 42 | + number_format_i18n( $asp_theme_comment_count ), |
| 43 | + '<span>' . get_the_title() . '</span>' |
| 44 | + ); |
| 45 | + } |
| 46 | + ?> |
| 47 | + </h2><!-- .comments-title --> |
| 48 | + |
| 49 | + <?php the_comments_navigation(); ?> |
| 50 | + |
| 51 | + <ol class="comment-list"> |
| 52 | + <?php |
| 53 | + wp_list_comments( array( |
| 54 | + 'style' => 'ol', |
| 55 | + 'short_ping' => true, |
| 56 | + ) ); |
| 57 | + ?> |
| 58 | + </ol><!-- .comment-list --> |
| 59 | + |
| 60 | + <?php |
| 61 | + the_comments_navigation(); |
| 62 | + |
| 63 | + // If comments are closed and there are comments, let's leave a little note, shall we? |
| 64 | + if ( ! comments_open() ) : |
| 65 | + ?> |
| 66 | + <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'asp-theme' ); ?></p> |
| 67 | + <?php |
| 68 | + endif; |
| 69 | + |
| 70 | + endif; // Check for have_comments(). |
| 71 | + |
| 72 | + comment_form(); |
| 73 | + ?> |
| 74 | + |
| 75 | +</div><!-- #comments --> |
0 commit comments