diff --git a/src/wp-content/themes/twentyfifteen/functions.php b/src/wp-content/themes/twentyfifteen/functions.php index 71b42e6c6e151..620f44ac127d2 100644 --- a/src/wp-content/themes/twentyfifteen/functions.php +++ b/src/wp-content/themes/twentyfifteen/functions.php @@ -412,7 +412,7 @@ function twentyfifteen_fonts_url() { * @since Twenty Fifteen 1.1 */ function twentyfifteen_javascript_detection() { - echo "\n"; + wp_print_inline_script_tag( "(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);" ); } add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 ); diff --git a/src/wp-content/themes/twentynineteen/functions.php b/src/wp-content/themes/twentynineteen/functions.php index dd21afc17c05b..5a385b5c3b662 100644 --- a/src/wp-content/themes/twentynineteen/functions.php +++ b/src/wp-content/themes/twentynineteen/functions.php @@ -303,11 +303,7 @@ function twentynineteen_scripts() { */ function twentynineteen_skip_link_focus_fix() { // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`. - ?> - - (function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);\n"; + wp_print_inline_script_tag( "(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);" ); } add_action( 'wp_head', 'twentyseventeen_javascript_detection', 0 ); diff --git a/src/wp-content/themes/twentysixteen/functions.php b/src/wp-content/themes/twentysixteen/functions.php index 49b3f2cb9ad01..a77c186febf8a 100644 --- a/src/wp-content/themes/twentysixteen/functions.php +++ b/src/wp-content/themes/twentysixteen/functions.php @@ -373,7 +373,7 @@ function twentysixteen_fonts_url() { * @since Twenty Sixteen 1.0 */ function twentysixteen_javascript_detection() { - echo "\n"; + wp_print_inline_script_tag( "(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);" ); } add_action( 'wp_head', 'twentysixteen_javascript_detection', 0 ); diff --git a/src/wp-content/themes/twentytwenty/functions.php b/src/wp-content/themes/twentytwenty/functions.php index a966f1bda719c..a185b6e71abc2 100644 --- a/src/wp-content/themes/twentytwenty/functions.php +++ b/src/wp-content/themes/twentytwenty/functions.php @@ -252,11 +252,7 @@ function twentytwenty_register_scripts() { */ function twentytwenty_skip_link_focus_fix() { // The following is minified via `terser --compress --mangle -- assets/js/skip-link-focus-fix.js`. - ?> - - - - '; - include get_template_directory() . '/assets/js/dark-mode-toggler.js'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude - echo ''; + $script = file_get_contents( get_template_directory() . '/assets/js/dark-mode-toggler.js' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude + wp_print_inline_script_tag( $script ); } /** diff --git a/src/wp-content/themes/twentytwentyone/functions.php b/src/wp-content/themes/twentytwentyone/functions.php index f163e394df734..98ab55ca9d15d 100644 --- a/src/wp-content/themes/twentytwentyone/functions.php +++ b/src/wp-content/themes/twentytwentyone/functions.php @@ -496,17 +496,12 @@ function twenty_twenty_one_skip_link_focus_fix() { // If SCRIPT_DEBUG is defined and true, print the unminified file. if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { - echo ''; + $script = file_get_contents( get_template_directory() . '/assets/js/skip-link-focus-fix.js' ); } else { // The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`. - ?> - - - - document.body.classList.remove("no-js");'; + wp_print_inline_script_tag( "document.body.classList.remove('no-js');" ); } add_action( 'wp_footer', 'twenty_twenty_one_supports_js' );