Modernizr - Add class to element (3 posts)

  1. timrutter
    Posted 4 years ago #

    I need to be able to add the class 'no-js' to the 'html' element, hopefully using a simple filter or option in the functions.php file or the like.

    Basically I would prefer not to edit the template files.

    currently I am using the following in the functions file with thematic.

    function childtheme_create_doctype($content) {
    	$content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
    	$content .= '<html xmlns="http://www.w3.org/1999/xhtml" class="no-js"';
    	return $content;
    add_filter('thematic_create_doctype', 'childtheme_create_doctype');
  2. Connor Montgomery
    Posted 4 years ago #

    The only way to add something to a template is to edit a template file... ;)

    But on a more serious note - what's the URL for your site? Is that function not working? I see you created/edited that function, but are you including it in all of your pages so it dynamically creates the header?

  3. Ramoonus
    Posted 4 years ago #

    I`ve released a plugin to make this easier

Topic Closed

This topic has been closed to new replies.

About this Topic