<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hybrid Garden &#187; html5</title>
	<atom:link href="http://hybridgarden.com/blog/tags/html5/feed/" rel="self" type="application/rss+xml" />
	<link>http://hybridgarden.com/blog</link>
	<description>Rhys Burnie&#039;s Artwork and Web Development blog</description>
	<lastBuildDate>Mon, 08 Nov 2010 23:58:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding html5 capability to WordPress</title>
		<link>http://hybridgarden.com/blog/misc/adding-html5-capability-to-wordpress/</link>
		<comments>http://hybridgarden.com/blog/misc/adding-html5-capability-to-wordpress/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 09:18:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web Devlopment]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://hybridgarden.com/blog/?p=30</guid>
		<description><![CDATA[There are two techniques that I find useful for making the WordPress content editor html5 capable. The first is to replace the default wpautop filter for the_excerpt &#38; the_content with Nicolas Gallagher&#8217;s html5autop filter.
The second is to allow html5 tags and attributes in tinyMCE otherwise the tags would be removed when switching between html view, [...]]]></description>
			<content:encoded><![CDATA[<p>There are two techniques that I find useful for making the WordPress content editor html5 capable. The first is to replace the default <strong>wpautop</strong> filter for <em>the_excerpt</em> &amp; <em>the_content</em> with Nicolas Gallagher&#8217;s <a href="http://nicolasgallagher.com/using-html5-elements-in-wordpress-post-content/"><strong>html5autop</strong></a> filter.</p>
<p>The second is to allow html5 tags and attributes in tinyMCE otherwise the tags would be removed when switching between html view, yes you can just use the code view permanently which seems to be a favorite <em>&#8220;solution&#8221;</em> offered by many developers whenever there&#8217;s an issue with the WYSIWYG but I for one would much rather use the WYSIWYG any day to coding in a crappy textarea. As one guy mentions in Nicholas&#8217; comments you can add tinyMCE settings via the <em>tiny_mce_before_init</em> WordPress filter. So I did this:</p>
<pre class="brush: php">function extend_valid_html5($init) {
	// Standard attributes
	$atts = 'role|accesskey|class|contenteditable|contextmenu|dir|draggable|hidden|id|item|itemprop|lang|spellcheck|style|subject|tabindex|title';
	$html5Elements = array(
		'article[#|cite|pubdate]',
		'aside[#]',
		'audio[#]',
		'canvas[#]',
		'command[#]',
		'datalist[#]',
		'details[#]',
		'figure[#]',
		'figcaption[#]',
		'footer[#]',
		'header[#]',
		'hgroup[#]',
		'mark[#]',
		'meter[#]',
		'nav[#]',
		'output[#]',
		'progress[#]',
		'section[#]',
		'summary[#]',
		'time[#|datetime]',
		'video[#]'
	);
	if(!isset($init['extended_valid_elements'])) {
		$init['extended_valid_elements'] = '';
	}
	$init['extended_valid_elements'] .= str_replace('#',$atts,implode(',',$html5Elements));
	return $init;
}

add_filter('tiny_mce_before_init', 'extend_valid_html5');
</pre>
<p>NB: Needs more attributes I&#8217;m just going to add them when I need them for now.</p>
<p>Nicholas adds his filter to the themes function.php file but I placed both filters into a html5support.php plugin which just sits there activated making the filters available, that way I can have multiple themes and not bother writing it into every themes function.php file.</p>
]]></content:encoded>
			<wfw:commentRss>http://hybridgarden.com/blog/misc/adding-html5-capability-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

