Changeset 55821 for trunk/src/wp-includes/post-thumbnail-template.php
- Timestamp:
- 05/17/2023 06:29:41 PM (2 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/post-thumbnail-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-thumbnail-template.php
r55093 r55821 187 187 } 188 188 189 // Add `loading` attribute.190 if ( wp_lazy_loading_enabled( 'img', 'the_post_thumbnail' ) ) {191 // Get the 'loading' attribute value to use as default, taking precedence over the default from192 // `wp_get_attachment_image()`.193 $loading = wp_get_loading_attr_default( 'the_post_thumbnail' );194 195 // Add the default to the given attributes unless they already include a 'loading' directive.196 if ( empty( $attr ) ) {197 $attr = array( 'loading' => $loading );198 } elseif ( is_array( $attr ) && ! array_key_exists( 'loading', $attr ) ) {199 $attr['loading'] = $loading;200 } elseif ( is_string( $attr ) && ! preg_match( '/(^|&)loading=/', $attr ) ) {201 $attr .= '&loading=' . $loading;202 }203 }204 205 189 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); 206 190
Note: See TracChangeset
for help on using the changeset viewer.