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. Merges [49860] to the 5.6 branch. Fixes #52139. Built from https://develop.svn.wordpress.org/branches/5.6@49861 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7c08559e8c
commit
ff94866fe6
|
@ -190,8 +190,8 @@ if ( ! function_exists( 'twenty_twenty_one_post_thumbnail' ) ) {
|
||||||
|
|
||||||
<figure class="post-thumbnail">
|
<figure class="post-thumbnail">
|
||||||
<?php
|
<?php
|
||||||
// Thumbnail is loaded eagerly because it's going to be in the viewport immediately.
|
// Lazy-loading attributes should be skipped for thumbnails since they are immediately in the viewport.
|
||||||
the_post_thumbnail( 'post-thumbnail', array( 'loading' => 'eager' ) );
|
the_post_thumbnail( 'post-thumbnail', array( 'loading' => false ) );
|
||||||
?>
|
?>
|
||||||
<?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?>
|
<?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>
|
<figcaption class="wp-caption-text"><?php echo wp_kses_post( wp_get_attachment_caption( get_post_thumbnail_id() ) ); ?></figcaption>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.6.1-alpha-49855';
|
$wp_version = '5.6.1-alpha-49861';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue