Reference › Functions twentyseventeen_post_thumbnail_sizes_attr ( string[] $attr , WP_Post $attachment , string | int[] $size ): string[]
Since Twenty Seventeen 1.0
Source wp-content/themes/twentyseventeen/functions.php:617Parameters Return Uses Source History Adds custom image sizes attribute to enhance responsive image functionality for post thumbnails.
Parameters
$attrstring[] Array of attribute values for the image markup, keyed by attribute name. See wp_get_attachment_image().
$attachmentWP_Post Image attachment post.
$sizestring | int[]Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order). Return
string[] The filtered attributes for the image markup. Uses · 3 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. Source View on Trac ↗ View on GitHub ↗
617 function twentyseventeen_post_thumbnail_sizes_attr ( $attr , $attachment , $size ) { 618 if ( is_archive ( ) || is_search ( ) || is_home ( ) ) { 619 $attr [ 'sizes' ] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px' ; 620 } else { 621 $attr [ 'sizes' ] = '100vw' ; 622 } 623 624 return $attr ; 625 } 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.