[wp-trac] [WordPress Trac] #39281: [twentyseventeen] header.php forces thumbnails on all post types

WordPress Trac noreply at wordpress.org
Wed Dec 14 19:19:28 UTC 2016


#39281: [twentyseventeen] header.php forces thumbnails on all post types
---------------------------+------------------------------
 Reporter:  justnorris     |       Owner:
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:  trunk
 Severity:  normal         |  Resolution:  worksforme
 Keywords:                 |     Focuses:  ui, template
---------------------------+------------------------------
Changes (by JPry):

 * status:  new => closed
 * focuses:  ui, template, performance => ui, template
 * resolution:   => worksforme


Comment:

 Hey @justnorris,

 Thanks for taking the time to log a ticket here on Trac!

 The twentyseventeen theme will only display a thumbnail when
 `has_post_thumbnail()` is true. As long there's no featured image set,
 then the theme won't try to display one. That means that there's no need
 to disable the thumbnail. Here's the relevant section of `header.php`:

 {{{#!php
         <?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() ) ) ) :
                 echo '<div class="single-featured-image-header">';
                 the_post_thumbnail( 'twentyseventeen-featured-image' );
                 echo '</div><!-- .single-featured-image-header -->';
         endif;
         ?>
 }}}

 It appears that WooCommerce is simply taking an extra precaution with
 hiding a possible featured image.

 When registering your custom post type, you can also make sure that it
 does '''not''' support `thumbnail` in the `supports` parameter. This will
 ensure that users cannot even set a featured image to begin with.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39281#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list