The Genesis Framework often uses the function
genesis_html5 to determine whether to output the XHTML or the HTML5 version of markup. You can use this function too if you’re writing a Genesis plugin that may be used on both XHTML and HTML5 sites, or you could even use it inside your child theme itself.
genesis_html5 is usually employed as a condition that determines whether to output an HTML5 version or an XHTML version of the same markup.
The below example outputs Schema.org microdata if the theme supports HTML5, and leaves it out if not.
This function does not accept arguments.
trueif the current child theme has added theme support for HTML5
falseif the current child theme has not added theme support for HTML5
falseif the function was called before the child theme has been processed
There are no filters on the output of this function.
genesis_html5 checks whether the child theme has added support for HTML5 markup. This means that it will always return false if it is checked before the child theme has been processed, even if the theme support is present.
In other words, the earliest hook on which this function can be run is
Genesis Simple Hooks
Genesis Simple Hooks, one of the most popular Genesis plugins, uses the function
genesis_html5 to determine whether to display the newer HTML5 Entry Hooks or the equivalent XHTML Post/Page Hooks.
If you have entered content into these fields, and then you switch your theme from an XHTML to an HTML5 (or an HTML5 to an XHTML, or you switch on or off your existing theme’s support of HTML5), you will lose access to the content you entered and it will cease to appear on your website. For this reason, it’s a good idea to copy any content into a text document before you switch, and then you can re-enter it.
genesis_html5 has been included since version 2.0.0.
genesis_html5 is located in lib/functions/general.php.
- How to Use HTML5 Markup with Genesis
- How to Make an Accessible Child Theme with Genesis
- How to Check if the Child Theme is Accessible with Genesis
Relevant tutorials from the Genesis community.