I’m not even going to acknowledge my terrible blogging habits ( or in reality, lack thereof ) and get to a little something something that will hopefully be of some use to someone.
With html5 making a lot of noise and gaining steam ( Google Voice & Youtube as examples ), it’s only a matter of time.
As I’m still in the process of learning the nuances of html5 I decided to use Starkers html5 as a learning ground. Being a typical twitter user I let the world know what I was up to. Nathan fairly quickly responded, asking my thoughts and recommendations on any adjustments, I replied in kind.
I sat down to see if I could tackle it, I’ve always been a bit wary of messing with the comments code for wordpress seeing as recursive code can get complicated if you don’t know exactly what is going on. I thought it was an excellent opportunity to learn and I came up with a (mostly) strait forward quick fix for now. I still want to go back and rewrite the wp_list_comments(); function but that will have to wait as I have other priorities.
My quick fix:
In the comments.php template file find this bit of code:
This will force your comments to display like the following:
<article>
<article>
</article>
</article>
...
...
A couple of notes
Usually, theme’s wrap the wp_list_comments(); call in an ordered list, this isn’t necessary for our super awesome html5 anymore since articles can (and I guess should) be nested. Personally I wrapped it in a div with “the_comments” as a class ( For styling purposes mainly. ).
These are the only changes I made to the starkers html5, take a look for yourself.
Feel free to use, modify and share as you like. Try to give references where they are due though, that’s all I ask.
Once I rewrite the function for wp_list_comments to handle ‘style=article’ I’ll let you all know.
html5 Comments in WordPress – quickfix
Introduction
I’m not even going to acknowledge my terrible blogging habits ( or in reality, lack thereof ) and get to a little something something that will hopefully be of some use to someone.
With html5 making a lot of noise and gaining steam ( Google Voice & Youtube as examples ), it’s only a matter of time.
On January 25th, 2010, a nice chap by the name of Nathan Staines released his html5 version of Elliot Jay Stocks‘ Starkers theme.
As I’m still in the process of learning the nuances of html5 I decided to use Starkers html5 as a learning ground. Being a typical twitter user I let the world know what I was up to. Nathan fairly quickly responded, asking my thoughts and recommendations on any adjustments, I replied in kind.
I sat down to see if I could tackle it, I’ve always been a bit wary of messing with the comments code for wordpress seeing as recursive code can get complicated if you don’t know exactly what is going on. I thought it was an excellent opportunity to learn and I came up with a (mostly) strait forward quick fix for now. I still want to go back and rewrite the wp_list_comments(); function but that will have to wait as I have other priorities.
My quick fix:
In the comments.php template file find this bit of code:
We’ll be using this instead:
In your theme’s functions.php file we’ll be adding the following code:
This will force your comments to display like the following:
A couple of notes
Usually, theme’s wrap the
wp_list_comments();call in an ordered list, this isn’t necessary for our super awesome html5 anymore since articles can (and I guess should) be nested. Personally I wrapped it in a div with “the_comments” as a class ( For styling purposes mainly. ).These are the only changes I made to the starkers html5, take a look for yourself.
Feel free to use, modify and share as you like. Try to give references where they are due though, that’s all I ask.
Once I rewrite the function for wp_list_comments to handle ‘style=article’ I’ll let you all know.
More on html5
W3C html5 spec overview
WhatWG.org html5 Working Draft
html5Doctor
html5 Gallery