mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Twenty Seventeen: Hardens the logic for calling featured image in header.php
This change uses `get_queried_object_id()` here since the `$post` global may not be set before a call to `the_post()`. Props westonruter. Fixes #39302. Built from https://develop.svn.wordpress.org/trunk@39624 git-svn-id: http://core.svn.wordpress.org/trunk@39564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7d70dabf59
commit
4177e37593
@ -41,10 +41,14 @@
|
||||
</header><!-- #masthead -->
|
||||
|
||||
<?php
|
||||
// If a regular post or page, and not the front page, show the featured image.
|
||||
if ( has_post_thumbnail() && ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) ) :
|
||||
|
||||
/*
|
||||
* If a regular post or page, and not the front page, show the featured image.
|
||||
* Using get_queried_object_id() here since the $post global may not be set before a call to the_post().
|
||||
*/
|
||||
if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) :
|
||||
echo '<div class="single-featured-image-header">';
|
||||
the_post_thumbnail( 'twentyseventeen-featured-image' );
|
||||
echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' );
|
||||
echo '</div><!-- .single-featured-image-header -->';
|
||||
endif;
|
||||
?>
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-39623';
|
||||
$wp_version = '4.8-alpha-39624';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user