equal
deleted
inserted
replaced
184 |
184 |
185 if ( in_the_loop() ) { |
185 if ( in_the_loop() ) { |
186 update_post_thumbnail_cache(); |
186 update_post_thumbnail_cache(); |
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; |
|
200 } |
|
201 |
|
202 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); |
189 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); |
203 |
190 |
204 /** |
191 /** |
205 * Fires after fetching the post thumbnail HTML. |
192 * Fires after fetching the post thumbnail HTML. |
206 * |
193 * |