The great folks at WordPress have come out with a new default theme along with WordPress 3.4, and it is a very good one. Twenty Twelve is responsive, clean, and easy to work with. So of course I naturally had to add my Schema.org data back into it once I activated it!
Very similar to what I had done with Twenty Eleven, I created a child theme that extends the default Twenty Twelve by adding microdata into the markup. I also added in a three widget section to the footer, a feature of T11 that I missed in T12. Hopefully this can be of use to others as well. What follows is the same description from the T11 Schema.org child theme that I had previously written.
By adding Schema.org microdata to the Twenty Twelve theme, we gain several benefits. Google, along with several other large companies like Bing and Yahoo, introduced Schema.org, a collection of microdata formats that can be used as a common machine language to identify bits and pieces of web pages. This theme incorporates that language and embeds it directly into your site.
Sure. Here is a side-by-side of the author section of a blog post (slightly abbreviated from the real source). Note the elements that were added, and then how Google’s rich snippets tool pulls them out.
Without Schema.org embedded
With Schema.org embedded
Google’s Rich Snippets Extract
Download the Twenty Twelve Schema.org Child Theme: Twenty Twelve Schema.org Child Theme – v1.0
I would appreciate any feedback you have or any bugs you notice, and you can get in touch with me here.
Hi, I chose Twenty Twelve as a base (mini framework) for my web dev. projects and I think your addition is really worth to be included!
Are you planing to make more improvements to this theme, or it’s going to be static as your Twenty Eleven for schema.org?
Thanks! I plan on tracking Twenty Twelve (hopefully better than I did T11) but don’t plan on adding new features other than the Schema.org markup. Is this what you’re thinking?
I have plan to create 2012 child theme and put some additional bits and snippets to make it better (according to my limited understanding).
I was thinking about forking your project (in case of further improvements), but I guess then it’s gonna be better just to create new one.
In any way thanks for doing good job with schema.org!
Definitely fork it! With the wonders of Git you would be able to build on it as a base, add your own stuff, keep the two in sync when I update it, and could even put in pull requests to go back and forth between projects. Would be a very smooth way to go.
This is great. I love schema.org. Looking at your repo though, it seems like you’ve overridden so many files of the theme so that making it a child theme is almost pointless. I’m curious why you didn’t just fork it? Was it for the few files that don’t get overridden (at least functions.php).
That’s right Mark, both for functions.php and for the styles. I’d much rather just check compatibility each time T12 is updated rather than bring over copies of files that had changed. Maintenance was easier on my end, and I didn’t really see any benefit to a fork.
Thanks for this., I’m using it for my child theme but, I’m getting an error
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘twentytwelve_allow_schema_markup’ not found or invalid function name
All, Scott fixed this and pushed a change on Github. Thanks Scott!
I ran my site through the structured data testing tool (using your theme) and was getting a missing “updated” field, I changed
<time class="updatedin functions, is this ok to do? It did remove the error.
Keep the entry-date class in there as well, so the tag should read
<time class="entry-date updated" .... I’ll pop that in the Github repo as well.
Great idea. I am new to schema and also trying out Twenty Twelve again. Thanks.
Hi, Joshua, finally I got my theme approved, it includes your code, credit given 😉
Congratulations, it looks like a great bundle of functionality! Way to go.
recently I was solving the question about the use of function_exists and noticed that you usually wrap it with IF after add_action or add_filter but standard Twenty Twelve functions are usually wrapped before add_action or add_filter.
Is there any difference? And just to have same style, could I move ENDIF before add_action or add_filter?
I started discussion here:
As catacaustic answered in the forum post, it won’t really matter much, but it does have a slightly different interpretation, and catacaustic explained it well. Hope that helps! And thanks for catching the bug on on itemprop, I committed a change on GitHub for it.