(Added mention of 2nd param req'd & 3.9 gallery/caption values) |
(→Adding Theme Support: add teh missing meta style and script.) |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Languages| |
{{Languages| |
||
− | {{en| |
+ | {{en|Theme Markup}} |
{{ja|Semantic Markup}} |
{{ja|Semantic Markup}} |
||
}} |
}} |
||
− | ''' |
+ | '''Theme Markup''' is a [[Theme Features|theme feature]], first introduced in [[Version 3.6]]. This feature allows themes to explicitly choose to apply HTML5 markup for search forms, comment forms, comment lists, gallery and caption. |
== Adding Theme Support == |
== Adding Theme Support == |
||
− | Since [[Version 3.6]], themes should use [[Function_Reference/add_theme_support|add_theme_support()]] in the [[Theme_Development#Functions_File|functions.php]] file in order to support |
+ | Since [[Version 3.6]], themes should use [[Function_Reference/add_theme_support|add_theme_support()]] in the [[Theme_Development#Functions_File|functions.php]] file in order to support theme markup, like so: |
<pre>add_theme_support( 'html5', array( 'gallery' ) );</pre> |
<pre>add_theme_support( 'html5', array( 'gallery' ) );</pre> |
||
− | The second parameter accepts one or more values indicating which HTML5 features to support. Support for 'search-form |
+ | The second parameter accepts one or more values indicating which HTML5 features to support. Support for '<tt>search-form</tt>', '<tt>comment-form</tt>' and '<tt>comment-list</tt>' were added in [[Version 3.6]]. Support for '<tt>gallery</tt>' and '<tt>caption</tt>' were added in [[Version 3.9]].: |
<pre> |
<pre> |
||
Line 19: | Line 19: | ||
'comment-list', |
'comment-list', |
||
'gallery', |
'gallery', |
||
− | 'caption' |
+ | 'caption', |
+ | |||
+ | 'meta', |
||
+ | 'style', |
||
+ | 'script', |
||
); |
); |
||
add_theme_support( 'html5', $args ); |
add_theme_support( 'html5', $args ); |
||
Line 25: | Line 29: | ||
The second argument is a required parameter for forward compatibility reasons. Namely, so a theme won't break in newer versions of WordPress that have HTML5 features not supported by an older theme. |
The second argument is a required parameter for forward compatibility reasons. Namely, so a theme won't break in newer versions of WordPress that have HTML5 features not supported by an older theme. |
||
+ | |||
+ | == Changelog == |
||
+ | |||
+ | * [[Version 3.6|3.6]]: Introduced with '<tt>search-form</tt>', '<tt>comment-form</tt>' and '<tt>comment-list</tt>' support |
||
+ | * [[Version 3.9|3.9]]: Added '<tt>gallery</tt>' and '<tt>caption</tt>' support |
||
+ | |||
+ | == Notes == |
||
+ | |||
+ | * '''Galleries & Captions:''' As of version 3.9 WordPress uses <code><figure></code> and <code><figcaption></code> elements, instead of the generic definition list markup to output [[The WordPress Gallery|galleries]]. More on this in the [http://make.wordpress.org/core/2014/04/15/html5-galleries-captions-in-wordpress-3-9/ Make WordPress Core article]. |
||
== Resources == |
== Resources == |
||
* [http://generatewp.com/theme-support/ WordPress Theme Support Generator] |
* [http://generatewp.com/theme-support/ WordPress Theme Support Generator] |
||
− | * [http://make.wordpress.org/core/2014/04/15/html5-galleries-captions-in-wordpress-3-9/ Make.WordPress.org announcement of gallery/caption support & required 2nd parameter] |
||
== Related == |
== Related == |
Languages: English • Markup 日本語 (Add your language)
Theme Markup is a theme feature, first introduced in Version 3.6. This feature allows themes to explicitly choose to apply HTML5 markup for search forms, comment forms, comment lists, gallery and caption.
Since Version 3.6, themes should use add_theme_support() in the functions.php file in order to support theme markup, like so:
add_theme_support( 'html5', array( 'gallery' ) );
The second parameter accepts one or more values indicating which HTML5 features to support. Support for 'search-form', 'comment-form' and 'comment-list' were added in Version 3.6. Support for 'gallery' and 'caption' were added in Version 3.9.:
$args = array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'meta', 'style', 'script', ); add_theme_support( 'html5', $args );
The second argument is a required parameter for forward compatibility reasons. Namely, so a theme won't break in newer versions of WordPress that have HTML5 features not supported by an older theme.
<figure>
and <figcaption>
elements, instead of the generic definition list markup to output galleries. More on this in the Make WordPress Core article.Theme Support:
add_theme_support(),
remove_theme_support(),
current_theme_supports()
Theme Features:
sidebar,
menus,
post-formats,
title-tag,
custom-background,
custom-header,
custom-logo,
post-thumbnails,
automatic-feed-links,
html5,
editor-style,
content_width