Make WordPress Core

Ticket #39302: 39302.1.patch

File 39302.1.patch, 1.1 KB (added by davidakennedy, 8 years ago)

Adds comment with explanation.

  • src/wp-content/themes/twentyseventeen/header.php

     
    4141        </header><!-- #masthead -->
    4242
    4343        <?php
    44         // If a regular post or page, and not the front page, show the featured image.
    45         if ( has_post_thumbnail() && ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) ) :
     44
     45        /*
     46         * If a regular post or page, and not the front page, show the featured image.
     47         * Using get_queried_object_id() here since the $post global may not be set before a call to the_post().
     48         */
     49        if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) :
    4650                echo '<div class="single-featured-image-header">';
    47                 the_post_thumbnail( 'twentyseventeen-featured-image' );
     51                echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' );
    4852                echo '</div><!-- .single-featured-image-header -->';
    4953        endif;
    5054        ?>