Skip to content

Instantly share code, notes, and snippets.

@samikeijonen
Created June 17, 2016 09:02
Show Gist options
  • Select an option

  • Save samikeijonen/3fd0b2e7e77a393ab9c8292c7eaea344 to your computer and use it in GitHub Desktop.

Select an option

Save samikeijonen/3fd0b2e7e77a393ab9c8292c7eaea344 to your computer and use it in GitHub Desktop.
<?php
/**
* Handles JavaScript detection.
*
* Adds a `js` class to the root `<html>` element when JavaScript is detected.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_javascript_detection() {
echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
}
add_action( 'wp_head', 'twentysixteen_javascript_detection', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment