Reference › Functions twentyseventeen_content_image_sizes_attr ( string $sizes , array $size ): string
Since Twenty Seventeen 1.0
Source wp-content/themes/twentyseventeen/functions.php:562Parameters Return Uses Source History Add 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 ↗
562 function twentyseventeen_content_image_sizes_attr ( $sizes , $size ) { 563 $width = $size [ 0 ] ; 564 565 if ( 740 <= $width ) { 566 $sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px' ; 567 } 568 569 if ( is_active_sidebar ( 'sidebar-1' ) || is_archive ( ) || is_search ( ) || is_home ( ) || is_page ( ) ) { 570 if ( ! ( is_page ( ) && 'one-column' === get_theme_mod ( 'page_options' ) ) && 767 <= $width ) { 571 $sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px' ; 572 } 573 } 574 575 return $sizes ; 576 } 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 6.8.8 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.