Twenty Sixteen: Replace inline control structureв to improve code readability.
Fixes #38468. git-svn-id: https://develop.svn.wordpress.org/trunk@41343 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4dc1c28e57
commit
da4dd8eb56
@ -371,13 +371,20 @@ require get_template_directory() . '/inc/customizer.php';
|
||||
function twentysixteen_content_image_sizes_attr( $sizes, $size ) {
|
||||
$width = $size[0];
|
||||
|
||||
840 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px';
|
||||
if ( 840 <= $width ){
|
||||
$sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px';
|
||||
}
|
||||
|
||||
if ( 'page' === get_post_type() ) {
|
||||
840 > $width && $sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px';
|
||||
if ( 840 > $width ) {
|
||||
$sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px';
|
||||
}
|
||||
} else {
|
||||
840 > $width && 600 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px';
|
||||
600 > $width && $sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px';
|
||||
if ( 840 > $width && 600 <= $width ) {
|
||||
$sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px';
|
||||
} elseif ( 600 > $width ) {
|
||||
$sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px';
|
||||
}
|
||||
}
|
||||
|
||||
return $sizes;
|
||||
@ -397,8 +404,11 @@ add_filter( 'wp_calculate_image_sizes', 'twentysixteen_content_image_sizes_attr'
|
||||
*/
|
||||
function twentysixteen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
|
||||
if ( 'post-thumbnail' === $size ) {
|
||||
is_active_sidebar( 'sidebar-1' ) && $attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 60vw, (max-width: 1362px) 62vw, 840px';
|
||||
! is_active_sidebar( 'sidebar-1' ) && $attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 88vw, 1200px';
|
||||
if ( is_active_sidebar( 'sidebar-1' ) ) {
|
||||
$attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 60vw, (max-width: 1362px) 62vw, 840px';
|
||||
} else {
|
||||
$attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 88vw, 1200px';
|
||||
}
|
||||
}
|
||||
return $attr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user