Changeset 53157 for trunk/src/wp-includes/blocks/post-featured-image.php
- Timestamp:
- 04/12/2022 03:10:30 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/post-featured-image.php
r52042 r53157 20 20 $post_ID = $block->context['postId']; 21 21 22 $featured_image = get_the_post_thumbnail( $post_ID ); 22 $size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail'; 23 $post_title = trim( strip_tags( get_the_title( $post_ID ) ) ); 24 $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, array( 'alt' => $post_title ) ); 23 25 if ( ! $featured_image ) { 24 26 return ''; … … 44 46 $image_styles .= "object-fit:{$attributes['scale']};"; 45 47 } 46 $featured_image = str_replace( 'src=', "style='$image_styles' src=", $featured_image );48 $featured_image = str_replace( 'src=', 'style="' . esc_attr( $image_styles ) . '" src=', $featured_image ); 47 49 } 48 50
Note: See TracChangeset
for help on using the changeset viewer.