Add HTML5 Support to your WordPress Theme Using Jetpack

A lot of WordPress themes are now built entirely with HTML5. I think Rootdip (previously HTML5Press), was one of the first WordPress themes to utilize many HTML5 elements. Some themes, however, don’t make use of HTML5 at all. WordPress has the ability to allow the use of HTML5 markup for comment forms, comment lists, and search forms.

Your theme has to use add_theme_support( 'html5' ). Much of this was inspired by this post from Konstantin Obenland on ThemeShaper, as was the featured image for this post, heh.

Active Theme Support

This is really easy. All you need to do is call add_theme_support( 'html5' ), essentially. More specifically, in the functions.php file for your theme, add the following.

function prefix_setup() {
    add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form', ) );
add_action( 'after_setup_theme', 'prefix_setup' );

That’s all there is. Your comment lists, comment forms, and search forms will now be marked up with HTML5!

Comment lists, comment forms, and search forms are the only html5 arguments supported currently, it’s possible many different arguments will be added at a later date. It may not be required though.

If you do build support for this into your theme, it’d probably be a good idea to add it in as an option that users can enable or disable at their discretion.