twenty_twenty_one_can_show_post_thumbnail example



// If there is no featured-image, print the first image block found. if (
    ! twenty_twenty_one_can_show_post_thumbnail() &&
    has_block( 'core/image', get_the_content() )
) {

    twenty_twenty_one_print_first_instance_of_block( 'core/image', get_the_content() );
}

the_excerpt();
/** * 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 ) );
                ?>
Home | Imprint | This part of the site doesn't use cookies.