Changeset 55093 for trunk/src/wp-includes/post-thumbnail-template.php
- Timestamp:
- 01/19/2023 07:32:28 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-thumbnail-template.php
r52935 r55093 187 187 } 188 188 189 // Get the 'loading' attribute value to use as default, taking precedence over the default from 190 // `wp_get_attachment_image()`. 191 $loading = wp_get_loading_attr_default( 'the_post_thumbnail' ); 192 193 // Add the default to the given attributes unless they already include a 'loading' directive. 194 if ( empty( $attr ) ) { 195 $attr = array( 'loading' => $loading ); 196 } elseif ( is_array( $attr ) && ! array_key_exists( 'loading', $attr ) ) { 197 $attr['loading'] = $loading; 198 } elseif ( is_string( $attr ) && ! preg_match( '/(^|&)loading=/', $attr ) ) { 199 $attr .= '&loading=' . $loading; 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 from 192 // `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 } 200 203 } 201 204
Note: See TracChangeset
for help on using the changeset viewer.