🩹 Fix the comment list output (#3184)

This commit is contained in:
Brandon
2024-02-02 09:36:33 -06:00
committed by GitHub
parent a86946e39f
commit 308cc20859
2 changed files with 6 additions and 5 deletions

View File

@@ -24,7 +24,7 @@ class Comments extends Composer
{ {
return [ return [
'title' => $this->title(), 'title' => $this->title(),
'comments' => $this->comments(), 'responses' => $this->responses(),
'previous' => $this->previous(), 'previous' => $this->previous(),
'next' => $this->next(), 'next' => $this->next(),
'paginated' => $this->paginated(), 'paginated' => $this->paginated(),
@@ -43,7 +43,7 @@ class Comments extends Composer
/* translators: %1$s is replaced with the number of comments and %2$s with the post title */ /* translators: %1$s is replaced with the number of comments and %2$s with the post title */
_nx('%1$s response to “%2$s”', '%1$s responses to “%2$s”', get_comments_number(), 'comments title', 'sage'), _nx('%1$s response to “%2$s”', '%1$s responses to “%2$s”', get_comments_number(), 'comments title', 'sage'),
get_comments_number() === 1 ? _x('One', 'comments title', 'sage') : number_format_i18n(get_comments_number()), get_comments_number() === 1 ? _x('One', 'comments title', 'sage') : number_format_i18n(get_comments_number()),
'<span>'.get_the_title().'</span>' get_the_title()
); );
} }
@@ -52,7 +52,7 @@ class Comments extends Composer
* *
* @return string * @return string
*/ */
public function comments() public function responses()
{ {
if (! have_comments()) { if (! have_comments()) {
return; return;
@@ -61,6 +61,7 @@ class Comments extends Composer
return wp_list_comments([ return wp_list_comments([
'style' => 'ol', 'style' => 'ol',
'short_ping' => true, 'short_ping' => true,
'echo' => false,
]); ]);
} }

View File

@@ -1,12 +1,12 @@
@if (! post_password_required()) @if (! post_password_required())
<section id="comments" class="comments"> <section id="comments" class="comments">
@if ($comments) @if ($responses)
<h2> <h2>
{!! $title !!} {!! $title !!}
</h2> </h2>
<ol class="comment-list"> <ol class="comment-list">
@php($comments) {!! $responses !!}
</ol> </ol>
@if ($paginated) @if ($paginated)