Quickly Convert Thesis 1.8.5 to HTML 5

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.

Leave a Comment

Your email address will not be published. Required fields are marked *

Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

Comments must be made in accordance with the comment policy. This site uses Akismet to reduce spam; learn how your comment data is processed.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

the Rick Beckman archive
Scroll to Top