error in comments.php
-
Not sure if this has been brought up already, but just in case.
Issue: If a post or a page has exactly one comment, the comments-title shows “1 Comments” (note the “s” in “Comments”).
Cause:
comments.php Line 28
$count = get_comments_number();
The function get_comments_number() returns a numeric string.
As a result, on Line 30:
if ( 1 === $count ) {
returns false (a type mismatch) and runs the code in
} else {
(L32-34) instead.Note: After fixing the type mismtach above, it will return true on Line 30 (as it should). But this time, the following code on Line 31:
esc_html__( 'One Comment', 'block-lite' );
returns a string with a bunch of white-space (not empty, but just with white-space). Maybe on Line 31, it’s supposed to be
esc_html_e
and notesc_html__
(?).
- The topic ‘error in comments.php’ is closed to new replies.