A long time ago, I promised a tutorial on how to convert Thesis 1.8.5 from an XHTML Strict document type to the new hotness: HTML 5.
There are plenty of reasons to switch, and it really is quite simple!
Open your custom_functions.php
file, and simply drop in the following code:
/**
* HTML5
*/
function brazenly_output_as_html5( $doctype ) {
return '<!DOCTYPE html>' . "\n";
}
add_filter( 'thesis_doctype', 'brazenly_output_as_html5' );
/**
* Remove "profile"
*/
function brazenly_remove_profile( $profile ) {
return '';
}
add_filter( 'thesis_head_profile', 'brazenly_remove_profile' );
This code is pretty simple and does two very basic things:
(1) Thesis 1.8.5’s default document type is modified to output the much simpler HTML 5 document type.
(2) The one piece of code which I could find which fails HTML 5 validation is removed. This code simply points to the profile of XFN. Everything else in Thesis 1.8.5 works fine with the new document type, but if you find any issues, speak up.
Update for users of PHP 5.3.0 or newer:
The above block of code can be simplified through the use of anonymous functions into essentially two lines of code:
/**
* HTML5
*/
add_filter( 'thesis_doctype', function() { return '<!DOCTYPE html>' . "\n"; } );
/**
* Remove "profile"
*/
add_filter( 'thesis_head_profile', function() { return ''; } );
If you’re unsure whether your website is hosted on a server running PHP 5.3.0 or newer, please contact your web host or administrator.