WordPress「add_theme_support」で有効化できるテーマ機能一覧

WordPressのテーマに機能を追加するためのテンプレート関数がadd_theme_supportである。functions.phpに記述すると有効化できる機能を確認する。

コード

add_theme_supportでテーマに追加できる機能は以下のとおり。


// 投稿フォーマット
add_theme_support('post-formats', array('aside', 'gallery'));
// アイキャッチ有効化
add_theme_support('post-thumbnails');
// カスタム背景
add_theme_support('custom-background'); //引数を取れる
// カスタムヘッダー
add_theme_support('custom-header'); //引数を取れる
// フィードリンク
add_theme_support('automatic-feed-links');
// HTML5(コメントフォーム、検索フォーム、コメントリスト、ギャラリー)
add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption'));
// titleタグ有効化
add_theme_support('title-tag');
// メニュー有効化
add_theme_support('menus');

機能詳細

様々なことができるadd_theme_support


'post-formats',
'post-thumbnails',
'custom-header',
'custom-background',
'custom-logo',
'menus',
'automatic-feed-links',
'html5',
'title-tag',
'customize-selective-refresh-widgets',
'starter-content',
'responsive-embeds',
'align-wide',                 // 画面幅いっぱいの動画や画像を配置
'dark-editor-style',
'disable-custom-colors',
'disable-custom-font-sizes',
'editor-color-palette',         // ブロックエディタで利用できる色をテーマ側で指定
'editor-font-sizes',
'editor-styles',
'wp-block-styles',
'core-block-patterns'
'custom-line-height'          // ブロック設定に「行の高さ」追加

Related Tags