{"id":7871,"date":"2010-11-18T11:13:14","date_gmt":"2010-11-18T18:13:14","guid":{"rendered":"http:\/\/css-tricks.com\/"},"modified":"2013-06-03T06:28:26","modified_gmt":"2013-06-03T13:28:26","slug":"html5-shim-in-functions-php","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/wordpress\/html5-shim-in-functions-php\/","title":{"rendered":"HTML5 Shim in functions.php"},"content":{"rendered":"

Might as well keep your header.php clean and insert the shim from the functions.php file. <\/p>\n

\/\/ add ie conditional html5 shim to header\r\nfunction add_ie_html5_shim () {\r\n    echo '<!--[if lt IE 9]>';\r\n    echo '<script src=\"http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5.js\"><\/script>';\r\n    echo '<![endif]-->';\r\n}\r\nadd_action('wp_head', 'add_ie_html5_shim');<\/code><\/pre>\n

The shim is to enable HTML5 elements to be able to be styled through CSS in Internet Explorer versions less than 9.<\/p>\n","protected":false},"excerpt":{"rendered":"

Might as well keep your header.php clean and insert the shim from the functions.php file. \/\/ add ie conditional html5 shim to header function add_ie_html5_shim () { echo ‘<!–[if lt IE 9]>’; echo ‘<script src=”http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5.js”><\/script>’; echo ‘<![endif]–>’; } add_action(‘wp_head’, ‘add_ie_html5_shim’); The shim is to enable HTML5 elements to be able to be styled through CSS […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3229,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":17782,"url":"https:\/\/css-tricks.com\/snippets\/wordpress\/insert-images-with-figurefigcaption\/","url_meta":{"origin":7871,"position":0},"title":"Insert Images with Figure\/Figcaption","date":"August 18, 2012","format":false,"excerpt":"For a simple plugin or functions.php file: function html5_insert_image($html, $id, $caption, $title, $align, $url) { $html5 = \"\"; $html5 .= \"\"; if ($caption) { $html5 .= \"$caption\"; } $html5 .= \"\"; return $html5; } add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );","rel":"","context":"With 15 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":18895,"url":"https:\/\/css-tricks.com\/snippets\/wordpress\/insert-images-within-figure-element-from-media-uploader\/","url_meta":{"origin":7871,"position":1},"title":"Insert Images within Figure Element from Media Uploader","date":"October 12, 2012","format":false,"excerpt":"For your functions.php file or a functionality plugin: function html5_insert_image($html, $id, $caption, $title, $align, $url) { $html5 = \"\"; $html5 .= \"\"; if ($caption) { $html5 .= \"$caption\"; } $html5 .= \"\"; return $html5; } add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 ); It also takes what you enter as a caption\u2026","rel":"","context":"With 15 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9819,"url":"https:\/\/css-tricks.com\/video-screencasts\/99-overview-of-html5-forms-types-attributes-and-elements\/","url_meta":{"origin":7871,"position":2},"title":"#99: Overview of HTML5 Forms Types, Attributes, and Elements","date":"June 20, 2011","format":false,"excerpt":"HTML5 has a bunch of form-specific features that all make forms on the web better. Browser support for the features is all over the map, but many of the features can be thought of as progressive enhancement, so if it works, great, the form is better, if not, whatever. In\u2026","rel":"","context":"With 31 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":17533,"url":"https:\/\/css-tricks.com\/snippets\/html\/video-for-everybody-html5-video-with-flash-fallback\/","url_meta":{"origin":7871,"position":3},"title":"Video For Everybody (HTML5 Video with Flash Fallback)","date":"July 15, 2012","format":false,"excerpt":"Download Video: Closed Format: \"MP4\" Open Format: \"Ogg\" A complete explanation at Kroc Camen's site, the originator of this technique.","rel":"","context":"With 22 comments","img":{"alt_text":"__TITLE__","src":"__VIDEO__.JPG","width":350,"height":200},"classes":[]},{"id":3808,"url":"https:\/\/css-tricks.com\/snippets\/javascript\/make-html5-elements-work-in-old-ie\/","url_meta":{"origin":7871,"position":4},"title":"Make HTML5 Elements Work in Old IE","date":"September 4, 2009","format":false,"excerpt":"So that the DOM (and thus CSS) recognizes them as real elements: (function(){if(!\/*@cc_on!@*\/0)return;var e = \"abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video\".split(','),i=e.length;while(i--){document.createElement(e[i])}})() Hotlink Script:","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8422,"url":"https:\/\/css-tricks.com\/snippets\/html\/html5-article-structure-with-hnews\/","url_meta":{"origin":7871,"position":5},"title":"HTML5 Article Structure with hNews","date":"February 1, 2011","format":false,"excerpt":"The spec for hNews. But Will It Make You Happy? 08-07-2010 By Stephanie Rosenbloom ...article text... ...article text... Tammy Strobel in her pared-down, 400sq-ft apt. ...article text... ...article text... Share this Article Facebook Twitter Etc ...article text... ...article text... Find Great Vacations A version of this article appeared in print\u2026","rel":"","context":"With 27 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/7871"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=7871"}],"version-history":[{"count":2,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/7871\/revisions"}],"predecessor-version":[{"id":21824,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/7871\/revisions\/21824"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3229"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=7871"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=7871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}