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