How To Convert Your StudioPress Child Theme From XHTML to HTML 5

Now that Genesis 2.0 has been released in beta, you may already know it provides support for adding HTML 5 to all StudioPress child themes.

The only problem is, all existing child themes built on Genesis don’t include HTML 5 markup. In order to convert your child theme to HTML 5, you need to convert the XHTML markup to HTML 5.

Learn how to add HTML5 markup and check out the new Genesis HTML5 markup.

Step 1 : Select ALL CSS code from your child themes style.css file and paste it into the online converter using the link above.
Step 2 : Delete ALL the existing code from your child themes style.css file
Step 2: Copy the new code from the online converter and paste it back into your child themes style.css file.
Step 4: Copy one line of PHP code below and paste it in your child themes functions.php file.
Step 5: Clear your browser cache and reload your home page.

Code for step 4.

add_theme_support( 'html5' );

Here’s more detail on the new loop hooks which also need to be changed if applicable and other information you may find useful.

Before Entry

XHTML Hook Location – HTML5 Hook Location

genesis_before_post – genesis_before_entry

Entry Header

XHTML Hook Location – HTML5 Hook Location

genesis_before_post_title – genesis_entry_header

genesis_post_title – genesis_entry_header

genesis_after_post_title – genesis_entry_header

genesis_before_post_content – genesis_entry_header

Entry Content

XHTML Hook Location – HTML5 Hook Location

genesis_post_content – genesis_entry_content

Entry Footer

XHTML Hook Location – HTML5 Hook Location

genesis_after_post_content – genesis_entry_footer

After Entry

XHTML Hook Location – HTML5 Hook Location

genesis_after_post – genesis_after_entry

The chart is basically a table showing you the old XHTML on the left and the corresponding HTML 5 on the right. All you need to do is change the classes in your child themes style.css file.

Once you have made the changes, you can then add support for HTML 5 to your child theme after updating to Genesis 2.0.

Here’s an example which shows some of the differences for the header markup:

header

Changing Classes

To change all the classes, its suggested you copy your existing child theme to a local installation of WordPress and make the changes in your style.css file there. This way you can test out how it works, update to Genesis 2.0 and then add support for HTML 5 in your child theme.

Note: HTML 5 will not work in your child theme until you have updated to Genesis 2.0 and added support in your child theme for HTML 5.

Using your favorite text editor like Notepad++, you can simply use the search, find and replace feature to change from the old to new classes.

Changing Hooks

You may also need to change some of the genesis_hooks otherwise your functions won’t work after you add support for HTML 5 to your child theme.

I believe StudioPress will also publish a table comparing the name changes for the new and old hooks as well.

Testing Plugins

You may also want to download your plugins folder from your server and drag them into your local installation so you can test them for HTML 5 compatibility.

Comment Form Allowed Tags

One thing i did notice since converting to HTML 5 was the comment form allowed tags. I can’t be certain but it seems i have been receiving more spam comments including offers to buy Louis Vuitton handbags since changing to HTML 5.

comment form allowed tags

It may have something to do with the automated spam programs picking up on the fact the comment form now allows HTML tags.

spam html links in comments

This is a problem which is easily fixed as you can hide the form allowed tags using CSS code or remove the function completely using PHP code which is a better solution in my opinion.

Read more about how to remove comment form allowed tags in Genesis child themes.

Hiding HTML elements using CSS code doesn’t remove the output from the source code therefore may not be as effective.

I’ll be writing about how to remove comment form allowed tags shortly as well as reporting on whether removing them removes spam links in comments.

Problems

The only problems i had after changing the classes was some buttons on the home page which are non Genesis and the after post newsletter widget where i need to change to the new hooks.

Some of the home page widgets where also messed up which may have something to do with the new markup however its not a big problem as i simply removed the content using those widgets.

I made all the changes locally and tested before uploading the child themes style.css and functions.php files to the live site.

Conclusion

I have noticed an increase in search traffic after upgrading to HTML 5 however i cannot be certain its the result of the new markup. It could be a combination of the better markup, single post navigation links and support for schema microdata.

Update: Rafal Tomal from Copyblogger Media has developed a very handy online tool which makes it super easy to convert from XHTML to HTML 5.

Comments

51 responses to “How To Convert Your StudioPress Child Theme From XHTML to HTML 5”

  1. […] If you do enable HTML5 support, be prepared to dig into your theme files and update some things. Although there is fallback support for the XHTML markup, there are some things that will probably go wonky. If you want to go this route, here’s a good starter article from Brad Dalton on How To Convert Your StudioPress Child Theme From XHTML to HTML 5. […]

  2. […] for conversion, like Nick Croft’s post explaining Genesis 2.0, Brad Dalton’s how-to for converting your theme to HTML5, and Brian Gardner’sXHTML to HTML5 Comparison Chart. Be sure to look over these articles to gain […]

  3. […] Dalton’s post is an excellent guide on how to convert your Genesis child theme from XHTML to HTML-5 so I won’t cover that […]

  4. Brad

    I went through the conversion process and my header image is not showing. I’m sure I need to do something else.

    If you have some time, could you take a look?

    Todd

  5. Thanks for the reply.

    I did use the converter tool you suggested, it worked pretty well from what I perused afterwards.

    I’ll paste the codes in a bin.

    This is the stylesheet: http://pastebin.com/LYKu0Pjh

    And the functions: http://pastebin.com/fCqKrPuT

    Those are the only two files I’ve modified.

    Cheers

    1. Brad Dalton Avatar
      Brad Dalton

      Just had a quick look and noticed 2 problems.

      1. Some of your CSS classes are wrong and 2. you have placed your custom CSS code after the Media Queries.

      When you style individual widgets, you only need the section i.d class for the widget and not the selector class.

      PHP looks fine however you would need to check the 3rd parameter for any custom functions you have added.

      I would suggest you install the new Prom version and copy over your custom code.

      Check you widgets as well and make sure any inactive widgets aren’t populated.

      1. Hey Brad,

        I guess I’ll have to try and copy over the custom code to the Executive Pro. Quick question, if I modify the menus and the headers from Executive Pro, does it affect or make me lose my current settings on the old Executive theme in case I want to go back?

        Also, one of the problems I was having with Executive pro when I tested it was that the Wp Pro Quiz plugin I am using appeared to brake its design whenever I started it. I’m not sure if its because of the new jquery version, the malfunctioning id’s and class or simply the incomaptibility with this plugin and html5 , but the plugin is essential for my site traffic.

        Supposing it’s the jquery version, how would I go about downgrading it to the one I have in the old Executive?

        Much gratitude for your help.

        1. Brad Dalton Avatar
          Brad Dalton

          Simply backup your old theme locally. You don’t even need to uninstall it as the new version uses a different file name anyway.

          I’d find a new plugin. If WP Pro Quiz doesn’t work with HTML 5 then its not a very well coded plugin.

          There are plenty of other plugins which will work.

  6. Hey Brad! (you genesis omnipresent entity :p)

    Great article, it’s helped me get through what I thought would be a nightmare.

    There’s only a few minor things I’m not sure if you can help me with.

    At the beginning of my posts, the author and comment, link is broken, it also seems to double the author and comment links.

    The author bio box at the bottom isn’t aligning the image properly, the footer-widgets aren’t using the link color I selected (#d5b033) but simply inheriting the global link color of the site and the newsletter action box of the homepage is overlapping the bottom widgets completely screwing the bottom part of the page.

    Any help I can get will be much appreciated,

    Matthew

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Matthew

      Did you convert all the CSS code using an online tool and change the loop hooks?

      Happy to help but i can’t tell what the problem without seeing the PHP code which i can’t do unless i’m logged in.

  7. Hi Brad

    Thanks for the excellent post on upgrading to HTML5. I note that you converted Epik manually and wonder if you are able to share the required .php changes. I havent made any changes to the default .php files only the CSS but updating the style either manually or automatically does not convert the Home page of the theme. All the inner pages work fine.

    Im clearly missing some changes to functions and home.php but using the Genesis hooks reference these are not in the Epik php files so I am at a loss as to what to do next.

    I need to do a manual upgrade as its a fully populated site.

    Many Thanks in advance

    1. Brad Dalton Avatar
      Brad Dalton

      Hi Sally

      I believe the Developers of the Epik child theme already offer a new version which has been updated to HTML 5.

      If you’re doing this yourself manually, you will need to change any loop hooks in the child themes home.php and functions.php file to the new hooks. http://wpsites.net/wordpress-themes/new-genesis-2-0-loop-hooks-how-to-use-them/

      Note: The new hooks may also need to include a 3rd parameter for positioning priority.

      You will find the new hooks with any 3rd parameters in your themes HTML 5 version files.

      If you send me a copy, i will list them here in the comments.

      1. Hi Brad

        Thanks for the reply. Yes there is a new version but its a complete rewrite so I’m not able to compare which changes to make. I do need to do a manual upgrade for that reason. Unfortunately my expertise is rather limited to css changes and comparing PHP changes.

        I went through the hook link but none of these hooks appear in the old Epik version – hence my confusion.

        Thanks for your offer of taking a look at a copy – assume you mean the new version of functions.php and home.php? Would you like me to mail this over

        Many Thanks

        1. Brad Dalton Avatar
          Brad Dalton

          Yes send it to brad at my domain thanks

  8. Hi Brad,

    Have you seen neither studiopress nor coppybloger use html5 yet? Apple did the exact same thing when the latest technology was xhtml. They were using html 4.01 because of compatibility issues, I think.

    So my question is, how can I use genesis 2.01 _and_ still use xhtml? I know I can disable that one line of code in my functions.php file, but then the whole CSS breaks.

    The only way to fix it is manual??? Any suggestions?

    1. Brad Dalton Avatar
      Brad Dalton

      Hi William

      Simply update to Genesis 2.0.1 if your theme is using the old XHTML markup.

      Otherwise, you would need to change the class selectors back to XHTML and remove support for HTML 5 from your child themes functions.php file.

      I don’t think there’s a tool to change from HTML 5 to XHTML so you would need to do this manually which would take about 20-30 minutes.

  9. Thank you for this excellent post. Lots of people will be needing this 😉

    1. Brad Dalton Avatar
      Brad Dalton

      Hi Laura

      I know many people are still using the old XHTML markup.

      I understand they maybe a but reluctant to make big changes to their CSS code which is why i think its a good idea to test it on a local copy of your theme first.

      Thanks for the comment

  10. I used the Dynamic converter on a clean install of Metro and it worked fine. I also save the theme under a new name so I can jump back to the old theme on a production site if it doesn’t work.

    Brad, I’m getting slammed with those same spam links on all sites, updated or not.

    1. Brad Dalton Avatar
      Brad Dalton

      Hi MaAnna

      Yeah, good idea to test it locally and save a copy of the old them style sheet just in case.

      Which spam links are you referring too?

      1. The spam for the Louis Vuitton bags. Been seeing a radical increase of those on all sites.

        1. Brad Dalton Avatar
          Brad Dalton

          Yeah i think its because Akismet sometimes lets it through.

          I did get a warning about a problem with Akismet and know Jetpack has a few bugs as well.

          I wrote a small plugin named ‘Stop Comment Form Spam’ which works really well so i rarely see spam anymore.

  11. I updated this morning, but with the same result. I do have plugins and two months of sample content, so that might be what’s driving it. I’ll try it on a clean install and let you know. Thanks!

    Also, thanks for posting the Genesis 2.0 video that talks about Schema. Frankly, I’ve been overwhelmed, but it answers two of my biggest questions and I don’t have quite as much fear of it. Your blog is extremely helpful, and your answers in the StudioPress forums are informative and not a sales pitch, as I’ve seen quite a bit this week. I know users like myself appreciate that, and you probably don’t hear it often enough.

    Cheers!

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks for the kind words Angela.

  12. Thanks for this post! I tried this yesterday with Metro, but all the fonts were super huge. I went back to my old stylesheet and then tried again this morning (with a fresh brain and cup of tea). This time, however, the site is completely off. There is no sidebar until the footer. Very strange. I’m not quite sure what could be that different between yesterday and today, but I’ll keep working with it. (I’m quite certain is is a M.E. error.) I’d like to convert our demo site to HTML5 before launch next week.

    I really enjoy your tutorials and have recommended your blog to others. Thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks for the kind words Angela.

      It could be a missed selector class that has changed, new HTML 5 loop hook, plugin issue or maybe you need to save your permalinks.

      Personally, I find it always works when I convert the child theme locally when there’s no plugins or content.

      Out of the box, all the themes I have converted where a 2 minute job when using this method.

      I assume you’re running Genesis 2.0.1?

  13. Michael DeGuzman Avatar
    Michael DeGuzman

    For newbies and non-technical people this is still confusing. Does anyone have a very simple step-by-step guide or video on how to upgrade to 2.0 as well as convert to HTML5? While the above codes are simple to interpret and plugin to someone familiar with this, people like myself have no clue how to even begin. A “For Dummies” explanation or video on this would be very helpful.

    Your help would be much appreciated, as I would like to upgrade the PROSE theme and AGENTPRESS theme.

    Thank you.
    Michael

    1. Brad Dalton Avatar
      Brad Dalton

      All you need to do is:

      1. Add HTML support to your child theme (one line of PHP code)

      2. Use the online tool to convert the entire contents of your child themes style.css file to HTML 5

      3. You may need to change the old XHTML loop hooks to the new ones if applicable

      Its that easy.

      Links to the online converter and new loop hooks are in this post.

      Otherwise i offer a service for this.

  14. Kingsley Avatar

    Thank you, i did it and my theme broke…. i will stick with the XHTML

    1. Brad Dalton Avatar
      Brad Dalton

      Sorry to hear that Kingsley

      Must of missed something which is why i suggest converting your child theme over locally before using it on a live site.

  15. […] 9. How To Convert Your StudioPress Child Theme From XHTML to HTML5 […]

  16. Rob Cubbon Avatar
    Rob Cubbon

    I’m using that tool by Dynamik, Keith, thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      Rafal Tomal also has one which does the same thing.

      Should only take about a minute to convert your child theme to HTML 5 with either tool.

      1. Rob Cubbon Avatar
        Rob Cubbon

        True. Both are great tools, Brad. Thanks.

        1. Brad Dalton Avatar
          Brad Dalton

          No worries Rob.

  17. Keith Davis Avatar
    Keith Davis

    Probably try a few manual upgrades on local sites and offer clients upgrades using the Extender plugin and Eric’s CSS converter.

    1. Brad Dalton Avatar
      Brad Dalton

      Yeah that’s exactly what i am doing as well.

      Can’t believe it only takes less than a minute to update to HTML 5.

      That’s incredible.

      1. Keith Davis Avatar
        Keith Davis

        “Can’t believe it only takes less than a minute to update to HTML 5.
        That’s incredible.”

        Was that using Eric’s CSS converter?

        1. Brad Dalton Avatar
          Brad Dalton

          Yeah. Great tool which i think will get a lot of use shortly.

          1. Keith Davis Avatar
            Keith Davis

            Oh yes!
            A lot of use may be the understatement of the year.
            Cheers Brad.

  18. […] Brad Dalton recommends: “To change all the classes, its suggested you copy your existing child theme to a local installation of WordPress and make the changes in your style.css file there.” […]

  19. […] 9. How To Convert Your StudioPress Child Theme From XHTML to HTML5 […]

  20. […] If you do enable HTML5 support, be prepared to dig into your theme files and update some things. Although there is fallback support for the XHTML markup, there are some things that will probably go wonky. If you want to go this route, here’s a good starter article from Brad Dalton on How To Convert Your StudioPress Child Theme From XHTML to HTML 5. […]

  21. Keith Davis Avatar
    Keith Davis

    Check this out Brad.
    Great tool from Eric Hamm the Catalyst guy.

    http://dynamiktheme.com/genesis-xhtml-to-html5-css-converter/

    1. Brad Dalton Avatar
      Brad Dalton

      Good idea and i’m sure it will get plenty of use.

      I liked doing it manually because then i learn’t what the new classes for HTML 5 are.

      How about you Keith? Will you use the tool or manual method?

  22. […] for conversion, like Nick Croft’s post explaining Genesis 2.0, Brad Dalton’s how-to for converting your theme to HTML5, and Brian Gardner’s XHTML to HTML5 Comparison Chart. Be sure to look over these articles to […]

  23. Thanks for the article. Yesterday I saw Brian’s tweet about the comparison table of classes between XHTML and HTML5. Glad to know you’ve tried it and give your feedback. By doing side-by-side comparison, it looks much easier to convert to HTML5.

    1. Brad Dalton Avatar
      Brad Dalton

      One of the ways you can see how it works is to add support for HTML 5 to your child theme on a local installation.

      Initially you’ll see a messed up site but then once you start changing the classes using Brian Gardners table, you’ll see your sidebar and other elements will start working properly.

      Thanks for the comment.

  24. Keith Davis Avatar
    Keith Davis

    Just what I needed Brad

    “Brian Gardner from StudioPress has created a simple XHTML Vs HTML 5 comparison chart.”

    I saw Brian’s post and you’ve brought all the info together – useful.
    I’ll throw this out to #genesiswp on twitter.

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks Keith. Forgot about the Genesis Twitter hashtag. Should use it more often.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.