diff --git a/wp-includes/blocks/comments-title.php b/wp-includes/blocks/comments-title.php
index 300f079e2d..95ce36b6d8 100644
--- a/wp-includes/blocks/comments-title.php
+++ b/wp-includes/blocks/comments-title.php
@@ -23,8 +23,9 @@ function render_block_core_comments_title( $attributes ) {
$show_comments_count = ! empty( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount'];
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
$comments_count = get_comments_number();
- $post_title = '“' . get_the_title() . '”';
- $tag_name = 'h2';
+ /* translators: %s: Post title. */
+ $post_title = sprintf( __( '“%s”' ), get_the_title() );
+ $tag_name = 'h2';
if ( isset( $attributes['level'] ) ) {
$tag_name = 'h' . $attributes['level'];
}
diff --git a/wp-includes/blocks/cover.php b/wp-includes/blocks/cover.php
index 82ff93e6c0..fc1aed7b96 100644
--- a/wp-includes/blocks/cover.php
+++ b/wp-includes/blocks/cover.php
@@ -14,51 +14,23 @@
* @return string Returns the cover block markup, if useFeaturedImage is true.
*/
function render_block_core_cover( $attributes, $content ) {
- if ( false === $attributes['useFeaturedImage'] ) {
+ if ( 'image' !== $attributes['backgroundType'] || false === $attributes['useFeaturedImage'] ) {
return $content;
}
- $current_featured_image = get_the_post_thumbnail_url();
-
- if ( false === $current_featured_image ) {
- return $content;
- }
-
- $is_img_element = ! ( $attributes['hasParallax'] || $attributes['isRepeated'] );
- $is_image_background = 'image' === $attributes['backgroundType'];
-
- if ( $is_image_background && ! $is_img_element ) {
- $content = preg_replace(
- '/class=\".*?\"/',
- '${0} style="background-image:url(' . esc_url( $current_featured_image ) . ')"',
- $content,
- 1
+ if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) {
+ $attr = array(
+ 'class' => 'wp-block-cover__image-background',
+ 'data-object-fit' => 'cover',
);
- }
- if ( $is_image_background && $is_img_element ) {
- $object_position = '';
if ( isset( $attributes['focalPoint'] ) ) {
- $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' .
- round( $attributes['focalPoint']['y'] * 100 ) . '%';
+ $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
+ $attr['data-object-position'] = $object_position;
+ $attr['style'] = 'object-position: ' . $object_position;
}
- $image_template = '';
-
- $image = sprintf(
- $image_template,
- esc_attr( get_the_post_thumbnail_caption() ),
- esc_url( $current_featured_image ),
- esc_attr( $object_position ),
- esc_attr( $object_position )
- );
+ $image = get_the_post_thumbnail( null, 'post-thumbnail', $attr );
$content = str_replace(
'