mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-02-26 02:32:52 +00:00
Twenty Twenty-One: Do not specify loading=“eager” for single post thumbnails.
While `loading=“eager”` is a supported alternative to omitting the attribute entirely, browsers follow the value of this attribute explicitly when specified. Specifying `eager` would prevent the user from receiving any additional potential benefits implemented at the browser level, such as further mechanisms to automatically decide which elements to lazy-load. Props flixos90, ryelle, poena. Fixes #52139. git-svn-id: https://develop.svn.wordpress.org/trunk@49860 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9027e7c489
commit
6c7bb97313
@ -190,8 +190,8 @@ if ( ! function_exists( 'twenty_twenty_one_post_thumbnail' ) ) {
|
||||
|
||||
<figure class="post-thumbnail">
|
||||
<?php
|
||||
// Thumbnail is loaded eagerly because it's going to be in the viewport immediately.
|
||||
the_post_thumbnail( 'post-thumbnail', array( 'loading' => 'eager' ) );
|
||||
// Lazy-loading attributes should be skipped for thumbnails since they are immediately in the viewport.
|
||||
the_post_thumbnail( 'post-thumbnail', array( 'loading' => false ) );
|
||||
?>
|
||||
<?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?>
|
||||
<figcaption class="wp-caption-text"><?php echo wp_kses_post( wp_get_attachment_caption( get_post_thumbnail_id() ) ); ?></figcaption>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user