当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

「関数リファレンス/add theme support」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(原文コピー)
 
(見出しを翻訳)
1行目: 1行目:
 
{{NeedTrans}}
 
{{NeedTrans}}
== Description ==
+
== 説明<!--Description--> ==
  
 
Allows a theme to register support of a certain feature.  This should be called in the theme's <tt>functions.php</tt> file.
 
Allows a theme to register support of a certain feature.  This should be called in the theme's <tt>functions.php</tt> file.
  
== Usage ==
+
== 使い方<!--Usage--> ==
  
%%%<?php add_theme_support( $feature ); ?>%%%
+
<?php add_theme_support( $feature ); ?>
  
== Parameters ==
+
== パラメータ<!--Parameters--> ==
  
 
{{Parameter|$feature|string|Name for the feature the feature being added.}}
 
{{Parameter|$feature|string|Name for the feature the feature being added.}}
20行目: 20行目:
 
* 'editor-style'
 
* 'editor-style'
  
== Addable Features ==
+
== 追加できる機能<!--Addable Features--> ==
  
=== Custom Header ===
+
=== カスタムヘッダー<!--Custom Header--> ===
%%%<?php add_theme_support('custom-header'); ?>%%%
+
<?php add_theme_support('custom-header'); ?>
 
This option enables custom-header support for a Theme. With this option enabled, the [[Appearance Header SubPanel]] is made available, enabling the user to upload and/or specify a custom header image or color. This option became available with [[Version 3.0]].
 
This option enables custom-header support for a Theme. With this option enabled, the [[Appearance Header SubPanel]] is made available, enabling the user to upload and/or specify a custom header image or color. This option became available with [[Version 3.0]].
  
 
This option is used internally, and should not be called directly by a Theme. Instead, use [[Function_Reference/add_custom_image_header|add_custom_image_header()]] in functions.php:
 
This option is used internally, and should not be called directly by a Theme. Instead, use [[Function_Reference/add_custom_image_header|add_custom_image_header()]] in functions.php:
  
=== Custom Background ===
+
=== カスタム背景<!--Custom Background--> ===
%%%<?php add_theme_support('custom-background'); ?>%%%
+
<?php add_theme_support('custom-background'); ?>
 
This option enables custom-background support for a Theme. With this option enabled, the [[Appearance Background SubPanel]] is made available, enabling the user to upload and/or specify a custom background image or color. This option became available with [[Version 3.0]].
 
This option enables custom-background support for a Theme. With this option enabled, the [[Appearance Background SubPanel]] is made available, enabling the user to upload and/or specify a custom background image or color. This option became available with [[Version 3.0]].
  
35行目: 35行目:
  
 
Default usage:
 
Default usage:
%%%<?php add_custom_background(); ?>%%%
+
<?php add_custom_background(); ?>
  
=== Post Thumbnails ===
+
=== アイキャッチ画像<!--Post Thumbnails--> ===
%%%<?php add_theme_support('post-thumbnails'); ?>%%%
+
<?php add_theme_support('post-thumbnails'); ?>
 
This option enables post-thumbnail support for a Theme.  This option became available with [[Version 2.9]].
 
This option enables post-thumbnail support for a Theme.  This option became available with [[Version 2.9]].
  
 
This option must be called before the init hook is fired. That means it needs to be placed directly into functions.php or within a function attached to the after_setup_theme hook:
 
This option must be called before the init hook is fired. That means it needs to be placed directly into functions.php or within a function attached to the after_setup_theme hook:
  
====Displaying post thumbnails====
+
====アイキャッチ画像の表示<!--Displaying post thumbnails-->====
  
 
  // in your theme index.php or single.php or custom templates
 
  // in your theme index.php or single.php or custom templates
 
  the_post_thumbnail();
 
  the_post_thumbnail();
  
====Checking if thumbnail assigned before displaying====
+
====アイキャッチ画像が割り当てられているかチェックしてから表示する<!--Checking if thumbnail assigned before displaying-->====
  
 
Check if there is a post thumbnail assigned to the post before displaying it.  
 
Check if there is a post thumbnail assigned to the post before displaying it.  
56行目: 56行目:
 
  }
 
  }
  
===Navigation Menus===
+
===ナビゲーションメニュー<!--Navigation Menus-->===
%%%<?php add_theme_support('menus'); ?>%%%
+
<?php add_theme_support('menus'); ?>
 
This option enables Theme support for the naviagation menu ability.  This option became available with [[Version 3.0]].
 
This option enables Theme support for the naviagation menu ability.  This option became available with [[Version 3.0]].
  
 
When registering custom menus with [[Function_Reference/register_nav_menus|register_nav_menus()]] you do not need to call add_theme_support( 'menus' ). register_nav_menus() automatically registers custom menu support for the theme.
 
When registering custom menus with [[Function_Reference/register_nav_menus|register_nav_menus()]] you do not need to call add_theme_support( 'menus' ). register_nav_menus() automatically registers custom menu support for the theme.
  
===Feed Links===
+
===フィードリンク<!--Feed Links-->===
%%%<?php add_theme_support('automatic-feed-links'); ?>%%%
+
<?php add_theme_support('automatic-feed-links'); ?>
 
This option enables post and comment RSS feed links to head.  This should be used in place of the deprecated ''automatic_feed_links''.  This option became available with [[Version 3.0]].
 
This option enables post and comment RSS feed links to head.  This should be used in place of the deprecated ''automatic_feed_links''.  This option became available with [[Version 3.0]].
  
=== Editor Style ===
+
=== エディタのスタイル<!--Editor Style--> ===
%%%<?php add_theme_support('editor-style'); ?>%%%
+
<?php add_theme_support('editor-style'); ?>
 
This option enables custom Visual Editor CSS support for a Theme. With this option enabled, the Theme can provide a custom CSS file (<tt>editor-style.css</tt>) that will allow the Visual Editor display to coincide with the visual output of the Theme itself. This option became available with [[Version 3.0]].
 
This option enables custom Visual Editor CSS support for a Theme. With this option enabled, the Theme can provide a custom CSS file (<tt>editor-style.css</tt>) that will allow the Visual Editor display to coincide with the visual output of the Theme itself. This option became available with [[Version 3.0]].
  
73行目: 73行目:
  
 
Default usage:
 
Default usage:
%%%<?php add_editor_style(); ?>%%%
+
<?php add_editor_style(); ?>
 
Custom Visual Editor style sheet filename:
 
Custom Visual Editor style sheet filename:
%%%<?php add_editor_style('editor-style'); ?>%%%
+
<?php add_editor_style('editor-style'); ?>
 
Where <tt>'editor-style'</tt> is the name of the CSS file that contains the Visual Editor CSS information. (Note: defaults to 'editor-style.css')
 
Where <tt>'editor-style'</tt> is the name of the CSS file that contains the Visual Editor CSS information. (Note: defaults to 'editor-style.css')
  
== Notes ==
+
== 注<!--Notes--> ==
  
== Change Log ==
+
== 変更履歴<!--Change Log--> ==
  
 
* [[Version 2.9|2.9]]: Introdeced with <tt>'post-thumbnails'</tt> feature
 
* [[Version 2.9|2.9]]: Introdeced with <tt>'post-thumbnails'</tt> feature
 
* [[Version 3.0|3.0]]: Added <tt>'menus'</tt>, <tt>'automatic-feed-links'</tt>, <tt>'custom-header'</tt>, <tt>'custom-background'</tt> and <tt>'editor-style'</tt> features
 
* [[Version 3.0|3.0]]: Added <tt>'menus'</tt>, <tt>'automatic-feed-links'</tt>, <tt>'custom-header'</tt>, <tt>'custom-background'</tt> and <tt>'editor-style'</tt> features
  
== Source File ==
+
== ソースファイル<!--Source File--> ==
  
 
<tt>add_theme_support()</tt> is located in {{Trac|wp-includes/theme.php}}.
 
<tt>add_theme_support()</tt> is located in {{Trac|wp-includes/theme.php}}.
  
== Related ==
+
== 関連<!--Related--> ==
  
 
{{Theme Support}}
 
{{Theme Support}}

2010年9月3日 (金) 18:48時点における版

このページ「関数リファレンス/add theme support」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

説明

Allows a theme to register support of a certain feature. This should be called in the theme's functions.php file.

使い方

<?php add_theme_support( $feature ); ?>

パラメータ

$feature
string) (必須) Name for the feature the feature being added.
初期値: なし

Features list:

  • 'custom-header'
  • 'custom-background'
  • 'post-thumbnails'
  • 'menus'
  • 'automatic-feed-links'
  • 'editor-style'

追加できる機能

カスタムヘッダー

<?php add_theme_support('custom-header'); ?>

This option enables custom-header support for a Theme. With this option enabled, the Appearance Header SubPanel is made available, enabling the user to upload and/or specify a custom header image or color. This option became available with Version 3.0.

This option is used internally, and should not be called directly by a Theme. Instead, use add_custom_image_header() in functions.php:

カスタム背景

<?php add_theme_support('custom-background'); ?>

This option enables custom-background support for a Theme. With this option enabled, the Appearance Background SubPanel is made available, enabling the user to upload and/or specify a custom background image or color. This option became available with Version 3.0.

This option is used internally, and should not be called directly by a Theme. Instead, use add_custom_background() in functions.php:

Default usage:

<?php add_custom_background(); ?>

アイキャッチ画像

<?php add_theme_support('post-thumbnails'); ?>

This option enables post-thumbnail support for a Theme. This option became available with Version 2.9.

This option must be called before the init hook is fired. That means it needs to be placed directly into functions.php or within a function attached to the after_setup_theme hook:

アイキャッチ画像の表示

// in your theme index.php or single.php or custom templates
the_post_thumbnail();

アイキャッチ画像が割り当てられているかチェックしてから表示する

Check if there is a post thumbnail assigned to the post before displaying it.

if (has_post_thumbnail()) {
  the_post_thumbnail();
}

ナビゲーションメニュー

<?php add_theme_support('menus'); ?>

This option enables Theme support for the naviagation menu ability. This option became available with Version 3.0.

When registering custom menus with register_nav_menus() you do not need to call add_theme_support( 'menus' ). register_nav_menus() automatically registers custom menu support for the theme.

フィードリンク

<?php add_theme_support('automatic-feed-links'); ?>

This option enables post and comment RSS feed links to head. This should be used in place of the deprecated automatic_feed_links. This option became available with Version 3.0.

エディタのスタイル

<?php add_theme_support('editor-style'); ?>

This option enables custom Visual Editor CSS support for a Theme. With this option enabled, the Theme can provide a custom CSS file (editor-style.css) that will allow the Visual Editor display to coincide with the visual output of the Theme itself. This option became available with Version 3.0.

This option is used internally, and should not be called directly by a Theme. Instead, use add_editor_style() in functions.php:

Default usage:

<?php add_editor_style(); ?>

Custom Visual Editor style sheet filename:

<?php add_editor_style('editor-style'); ?>

Where 'editor-style' is the name of the CSS file that contains the Visual Editor CSS information. (Note: defaults to 'editor-style.css')

変更履歴

  • 2.9: Introdeced with 'post-thumbnails' feature
  • 3.0: Added 'menus', 'automatic-feed-links', 'custom-header', 'custom-background' and 'editor-style' features

ソースファイル

add_theme_support() is located in wp-includes/theme.php.

関連

テーマサポート: add_theme_support(), remove_theme_support(), current_theme_supports()
テーマ機能: サイドバー, ナビゲーションメニュー, 投稿フォーマット, 投稿サムネイル, カスタム背景, カスタムヘッダー, 自動フィードリンク, html5, コンテンツ幅, editor-style



関数リファレンステンプレートタグ目次もご覧ください。

最新英語版: WordPress Codex » Function Reference/add theme support最新版との差分