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.
Built from https://develop.svn.wordpress.org/trunk@26026 git-svn-id: http://core.svn.wordpress.org/trunk@25956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
72d4b140fb
commit
35af8942ab
|
@ -69,6 +69,7 @@ function twentyfourteen_setup() {
|
|||
|
||||
// Add several sizes for Post Thumbnails.
|
||||
add_image_size( 'post-thumbnail-slider', 1038, 576, true );
|
||||
add_image_size( 'post-thumbnail-full-width', 1038, 0 );
|
||||
add_image_size( 'post-thumbnail-grid', 672, 372, true );
|
||||
add_image_size( 'post-thumbnail', 672, 0 );
|
||||
|
||||
|
|
|
@ -172,14 +172,21 @@ function twentyfourteen_post_thumbnail() {
|
|||
?>
|
||||
|
||||
<div class="post-thumbnail">
|
||||
<?php the_post_thumbnail( 'post-thumbnail' ); ?>
|
||||
<?php
|
||||
if ( is_active_sidebar( 'sidebar-2' ) || wp_is_mobile() )
|
||||
the_post_thumbnail( 'post-thumbnail' );
|
||||
else
|
||||
the_post_thumbnail( 'post-thumbnail-full-width' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
||||
<?php if ( has_post_thumbnail() ) :
|
||||
<?php if ( has_post_thumbnail() && ( is_active_sidebar( 'sidebar-2' ) || wp_is_mobile() ) ) :
|
||||
the_post_thumbnail( 'post-thumbnail' );
|
||||
elseif ( has_post_thumbnail() ) :
|
||||
the_post_thumbnail( 'post-thumbnail-full-width' );
|
||||
else : ?>
|
||||
<p class="screen-reader-text"><?php _e( 'No featured image.', 'twentyfourteen' ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Reference in New Issue