Skip to content

Commit

Permalink
Use the default post comments template for the post comments listing
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Mar 27, 2020
1 parent be1bfb7 commit 8686244
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions packages/block-library/src/post-comments/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ function render_block_core_post_comments() {
if ( ! $post ) {
return '';
}
$comments = get_comments(
array(
'post_id' => $post->ID,
)
);
$output = '';
// TODO: Handle nested comments.
foreach ( $comments as $comment ) {
$output .= '<p>' . $comment->comment_author . '<br />' . $comment->comment_content . '</p>';
}
return $output;

ob_start();
// This generates a deprecate message.
// Ideally this deprecation is removed.
comments_template();
ob_get_clean();

ob_start();
wp_list_comments( array( 'page' => $post->ID ) );
$comments = ob_get_clean();

return $comments;
}

/**
Expand Down

0 comments on commit 8686244

Please sign in to comment.