Make WordPress Core

Ticket #25758: 25758.2.diff

File 25758.2.diff, 1.6 KB (added by iamtakashi, 11 years ago)
  • src/wp-content/themes/twentyfourteen/functions.php

     
    6969
    7070        // Add several sizes for Post Thumbnails.
    7171        add_image_size( 'post-thumbnail-slider', 1038, 576, true );
     72        add_image_size( 'post-thumbnail-full-width', 1038, 0 );
    7273        add_image_size( 'post-thumbnail-grid', 672, 372, true );
    7374        add_image_size( 'post-thumbnail', 672, 0 );
    7475
  • src/wp-content/themes/twentyfourteen/inc/template-tags.php

     
    172172        ?>
    173173
    174174        <div class="post-thumbnail">
    175                 <?php the_post_thumbnail( 'post-thumbnail' ); ?>
     175                <?php
     176                        if ( is_active_sidebar( 'sidebar-2' ) || wp_is_mobile() )
     177                                the_post_thumbnail( 'post-thumbnail' );
     178                        else
     179                                the_post_thumbnail( 'post-thumbnail-full-width' );
     180                ?>
    176181        </div>
    177182
    178183        <?php else : ?>
    179184
    180185        <a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
    181         <?php if ( has_post_thumbnail() ) :
     186        <?php if ( has_post_thumbnail() && ( is_active_sidebar( 'sidebar-2' ) || wp_is_mobile() ) ) :
    182187                the_post_thumbnail( 'post-thumbnail' );
     188        elseif ( has_post_thumbnail() ) :
     189                the_post_thumbnail( 'post-thumbnail-full-width' );
    183190        else : ?>
    184191                <p class="screen-reader-text"><?php _e( 'No featured image.', 'twentyfourteen' ); ?></p>
    185192        <?php endif; ?>