/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
function twenty_twenty_one_post_thumbnail() { if ( !
twenty_twenty_one_can_show_post_thumbnail() ) { return;
} ?>
<?php
if ( is_singular() ) : ?>
<figure class="post-thumbnail">
<?php
// Lazy-loading attributes should be skipped for thumbnails since they are immediately in the viewport.
the_post_thumbnail( 'post-thumbnail', array
( 'loading' => false
) );
?>