Make WordPress Core

Changeset 26026


Ignore:
Timestamp:
11/06/2013 08:39:50 PM (11 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: add full-width featured images for layouts without a content sidebar, but use wp_is_mobile() to load smaller-sized images for mobile. Props iamtakashi, fixes #25758.

Location:
trunk/src/wp-content/themes/twentyfourteen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r26020 r26026  
    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 );
  • trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php

    r25971 r26026  
    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
     
    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>
Note: See TracChangeset for help on using the changeset viewer.