Reference › Functions twentyseventeen_content_image_sizes_attr ( string $sizes , array $size ): string
Since Twenty Seventeen 1.0
Source wp-content/themes/twentyseventeen/functions.php:568Parameters Return Uses Source History Adds custom image sizes attribute to enhance responsive image functionality for content images.
Parameters
$sizesstring A source size value for use in a 'sizes' attribute.
$sizearray Image size. Accepts an array of width and height values in pixels (in that order). Return
string A source size value for use in a content image 'sizes' attribute. Uses · 6 is_active_sidebar() Determines whether a sidebar contains widgets. is_archive() Determines whether the query is for an existing archive page. is_search() Determines whether the query is for a search. is_home() Determines whether the query is for the blog homepage. is_page() Determines whether the query is for an existing single page. get_theme_mod() Retrieves theme modification value for the active theme. Source View on Trac ↗ View on GitHub ↗
568 function twentyseventeen_content_image_sizes_attr ( $sizes , $size ) { 569 $width = $size [ 0 ] ; 570 571 if ( 740 <= $width ) { 572 $sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px' ; 573 } 574 575 if ( is_active_sidebar ( 'sidebar-1' ) || is_archive ( ) || is_search ( ) || is_home ( ) || is_page ( ) ) { 576 if ( ! ( is_page ( ) && 'one-column' === get_theme_mod ( 'page_options' ) ) && 767 <= $width ) { 577 $sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px' ; 578 } 579 } 580 581 return $sizes ; 582 } History Introduced in Twenty Seventeen 1.0 . Unchanged from 6.7.7 through 7.1.0.
6.7.7 6.8.8 6.9.7 7.0.4 7.1.0 Signature, return type and hooks compared across 5 parsed releases.
About this page Parsed data Generated from the wordpress-develop 7.1.0 tag, from src/wp-content/themes/twentyseventeen/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. Corrections Something wrong on this page? Report it and it gets fixed in the next regeneration.