the_post_thumbnail example

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 ) );
                ?> <?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> <?php endif; ?> </figure><!-- .post-thumbnail --> <?php else : ?> <figure class="post-thumbnail"> <a class="post-thumbnail-inner alignwide" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1"> <?php the_post_thumbnail( 'post-thumbnail' ); ?>
Home | Imprint | This part of the site doesn't use cookies.