diff --git a/comments.php b/comments.php index 21a8635..c03da01 100644 --- a/comments.php +++ b/comments.php @@ -38,16 +38,18 @@ if ( post_password_required() ) { '' . get_the_title() . '' ); } else { - printf( // WPCS: XSS OK. - /* translators: 1: number of comments, 2: post title */ - esc_html( _nx( - '%1$s thought on “%2$s”', - '%1$s thoughts on “%2$s”', - $comments_number, - 'comments title', - 'understrap' - ) ), - number_format_i18n( $comments_number ), + printf( + esc_html( + /* translators: 1: number of comments, 2: post title */ + _nx( + '%1$s thought on “%2$s”', + '%1$s thoughts on “%2$s”', + $comments_number, + 'comments title', + 'understrap' + ) + ), + number_format_i18n( '$comments_number' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped '' . get_the_title() . '' ); } @@ -55,7 +57,7 @@ if ( post_password_required() ) { - 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?> + 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through. ?> - +
    @@ -90,7 +92,7 @@ if ( post_password_required() ) {
- 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?> + 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through. ?> - + - - - - -

- - + diff --git a/inc/custom-comments.php b/inc/custom-comments.php index 6292a74..f4fbfc2 100644 --- a/inc/custom-comments.php +++ b/inc/custom-comments.php @@ -87,3 +87,20 @@ if ( ! function_exists( 'understrap_bootstrap_comment_form' ) ) { return $args; } } // End of if function_exists( 'understrap_bootstrap_comment_form' ). + + +// Add note if comments are closed. +add_action( 'comment_form_comments_closed', 'understrap_comment_form_comments_closed' ); + +if ( ! function_exists( 'understrap_comment_form_comments_closed' ) ) { + /** + * Displays a note that comments are closed if comments are closed and there are comments. + */ + function understrap_comment_form_comments_closed() { + if ( get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) { + ?> +

+