utes['displayAvatar'] ) { $classnames[] = 'has-avatars'; } if ( $attributes['displayDate'] ) { $classnames[] = 'has-dates'; } if ( $attributes['displayExcerpt'] ) { $classnames[] = 'has-excerpts'; } if ( empty( $comments ) ) { $classnames[] = 'no-comments'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); return ! empty( $comments ) ? sprintf( '
    %2$s
', $wrapper_attributes, $list_items_markup ) : sprintf( '
%2$s
', $wrapper_attributes, __( 'No comments to show.' ) ); } /** * 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' );