From e1215e1268c0ca64e861b9868c8e6563e11ddd56 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Sat, 19 Nov 2016 04:54:14 +0000 Subject: [PATCH] Twenty Seventeen: Avoid an undefined index notice after [39291]. props westonruter. see #38847. git-svn-id: https://develop.svn.wordpress.org/trunk@39317 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyseventeen/functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentyseventeen/functions.php b/src/wp-content/themes/twentyseventeen/functions.php index a777a8cd94..1bcb95fc34 100644 --- a/src/wp-content/themes/twentyseventeen/functions.php +++ b/src/wp-content/themes/twentyseventeen/functions.php @@ -435,9 +435,12 @@ add_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_att * @return string The filtered header image HTML. */ function twentyseventeen_header_image_tag( $html, $header, $attr ) { - return str_replace( $attr['sizes'], '100vw', $html ); + if ( isset( $attr['sizes'] ) ) { + $html = str_replace( $attr['sizes'], '100vw', $html ); + } + return $html; } -add_filter ( 'get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3 ); +add_filter( 'get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3 ); /** * Add custom image sizes attribute to enhance responsive image functionality