You appear to be a bot. Output may be restricted
Description
Add custom image sizes attribute to enhance responsive image functionality for content images.
Usage
$string = twentyseventeen_content_image_sizes_attr( $sizes, $size );
Parameters
- $sizes
- ( string ) required – A source size value for use in a 'sizes' attribute.
- $size
- ( array ) required – Image size. Accepts an array of width and height values in pixels (in that order).
Returns
string A source size value for use in a content image 'sizes' attribute.
Source
File name: twentyseventeen/functions.php
Lines:
1 to 15 of 15
function twentyseventeen_content_image_sizes_attr( $sizes, $size ) { $width = $size[0]; if ( 740 <= $width ) { $sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px'; } if ( is_active_sidebar( 'sidebar-1' ) || is_archive() || is_search() || is_home() || is_page() ) { if ( ! ( is_page() && 'one-column' === get_theme_mod( 'page_options' ) ) && 767 <= $width ) { $sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px'; } } return $sizes; }