diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/blocks/latest-comments.php --- a/wp/wp-includes/blocks/latest-comments.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/blocks/latest-comments.php Tue Dec 15 13:49:49 2020 +0100 @@ -137,7 +137,7 @@ } $classnames = esc_attr( $class ); - $block_content = ! empty( $comments ) ? sprintf( + return ! empty( $comments ) ? sprintf( '
    %2$s
', $classnames, $list_items_markup @@ -146,40 +146,18 @@ $classnames, __( 'No comments to show.' ) ); - - return $block_content; } -register_block_type( - 'core/latest-comments', - array( - 'attributes' => array( - 'align' => array( - 'type' => 'string', - 'enum' => array( 'left', 'center', 'right', 'wide', 'full' ), - ), - 'className' => array( - 'type' => 'string', - ), - 'commentsToShow' => array( - 'type' => 'number', - 'default' => 5, - 'minimum' => 1, - 'maximum' => 100, - ), - 'displayAvatar' => array( - 'type' => 'boolean', - 'default' => true, - ), - 'displayDate' => array( - 'type' => 'boolean', - 'default' => true, - ), - 'displayExcerpt' => array( - 'type' => 'boolean', - 'default' => true, - ), - ), - 'render_callback' => 'render_block_core_latest_comments', - ) -); +/** + * Registers the `core/latest-comments` block. + */ +function register_block_core_latest_comments() { + register_block_type_from_metadata( + __DIR__ . '/latest-comments', + array( + 'render_callback' => 'render_block_core_latest_comments', + ) + ); +} + +add_action( 'init', 'register_block_core_latest_comments' );