theme.json バージョン2 リファレンス

これは theme.json バージョン 2の仕様です。このバージョンは WordPress 5.9以降で動作します。

theme.json バージョン 3が WordPress 6.6でリリースされました。WordPress は 引き続き theme.json version 2をサポートしますが、新機能は 新しいバージョン にのみ追加されます。

アップグレードの準備ができたら、theme.json 移行ガイド で最新版へのアップデートの詳細を参照してください。

このリファレンスガイドでは theme.json スキーマで定義されている設定とスタイルのプロパティを列挙します。テーマで theme.json ファイルを使用する方法については、theme.json 利用ガイドを参照してください。

JSON スキーマ

バージョン2の最後のスキーマは https://schemas.wp.org/wp/6.5/theme.json にあります。

各 WordPress バージョンの theme.json スキーマは、https://schemas.wp.org/wp/{{version}}/theme.json から利用できます。例えば、WordPress 5.9用のスキーマは https://schemas.wp.org/wp/5.9/theme.json にあります。

お使いのエディターで JSON スキーマを使用する方法については theme.json を使用した開発を参照してください。

settings

appearanceTools

以下のUIツールを有効にする設定。

  • background: backgroundImage, backgroundSize
  • border: color, radius, style, width
  • color: link
  • dimensions: aspectRatio, minHeight
  • position: sticky
  • spacing: blockGap, margin, padding
  • typography: lineHeight

useRootPaddingAwareAlignments

ルートブロックの代わりに全幅ブロックの内容に、ルートパディング (styles.spacing.padding の値) を適用することを可能にします。

注意: この設定を使用する場合、styles.spacing.padding は常にオブジェクトとして設定し、toprightbottomleftの値は別々に宣言する必要があります。


border

ボーダー関連の設定。

PropertyTypeDefaultProps
colorbooleanfalse
radiusbooleanfalse
stylebooleanfalse
widthbooleanfalse

shadow

シャドー関連の設定。

PropertyTypeDefaultProps
defaultPresetsbooleantrue
presetsarrayname, shadow, slug

color

色関連の設定。

PropertyTypeDefaultProps
backgroundbooleantrue
custombooleantrue
customDuotonebooleantrue
customGradientbooleantrue
defaultDuotonebooleantrue
defaultGradientsbooleantrue
defaultPalettebooleantrue
duotonearraycolors, name, slug
gradientsarraygradient, name, slug
linkbooleanfalse
palettearraycolor, name, slug
textbooleantrue
headingbooleantrue
buttonbooleantrue

background

背景関連の設定。

PropertyTypeDefaultProps
backgroundImagebooleanfalse

dimensions

寸法関連の設定。

PropertyTypeDefaultProps
aspectRatiobooleanfalse
minHeightbooleanfalse

layout

レイアウト関連の設定。

PropertyTypeDefaultProps
contentSizestring
wideSizestring
allowEditingbooleantrue
allowCustomContentAndWideSizebooleantrue

lightbox 関連の設定。

PropertyTypeDefaultProps
enabledboolean
allowEditingboolean

position

位置関連の設定。

PropertyTypeDefaultProps
stickybooleanfalse

spacing

スペース関連の設定。

PropertyTypeDefaultProps
blockGapboolean, nullnull
marginbooleanfalse
paddingbooleanfalse
unitsarraypx,em,rem,vh,vw,%
customSpacingSizebooleantrue
spacingSizesarrayname, size, slug
spacingScaleobject

typography

タイポグラフィ関連の設定。

PropertyTypeDefaultProps
customFontSizebooleantrue
fontStylebooleantrue
fontWeightbooleantrue
fluidobject, booleanfalse{maxViewportWidth, minFontSize, minViewportWidth}
letterSpacingbooleantrue
lineHeightbooleanfalse
textColumnsbooleanfalse
textDecorationbooleantrue
writingModebooleanfalse
textTransformbooleantrue
dropCapbooleantrue
fontSizesarrayfluid, name, size, slug
fontFamiliesarrayfontFace, fontFamily, name, slug

custom

--wp--custom--{key}--{nested-key}: {value};」形式のカスタム CSS カスタムプロパティを生成します。camelCased のキーは、CSSプロパティ命名スキーマに従うために、 kebab-case に変換されます。異なる深さのレベルのキーは -- で区切られるため、キーの名前に -- を含めないでください。


Styles

border

ボーダーのスタイル。

PropertyTypeProps
colorstring, object
radiusstring, object
stylestring, object
widthstring, object
topobjectcolor, style, width
rightobjectcolor, style, width
bottomobjectcolor, style, width
leftobjectcolor, style, width

color

色のスタイル。

PropertyTypeProps
backgroundstring, object
gradientstring, object
textstring, object

dimensions

寸法のスタイル

PropertyTypeProps
aspectRatiostring, object
minHeightstring, object

spacing

スペースのスタイル。

PropertyTypeProps
blockGapstring, object
marginobjectbottom, left, right, top
paddingobjectbottom, left, right, top

typography

タイポグラフィのスタイル。

PropertyTypeProps
fontFamilystring, object
fontSizestring, object
fontStylestring, object
fontWeightstring, object
letterSpacingstring, object
lineHeightstring, object
textColumnsstring
textDecorationstring, object
writingModestring, object
textTransformstring, object

filter

CSS と SVG フィルターのスタイル。

PropertyTypeProps
duotonestring, object

shadow

ボックスシャドーのスタイル。


outline

アウトラインのスタイル。

PropertyTypeProps
colorstring, object
offsetstring, object
stylestring, object
widthstring, object

css

カスタム CSS を設定します。他の theme.json プロパティではカバーされないスタイルを適用できます。


customTemplates

テンプレートフォルダで定義されるカスタムテンプレートの追加メタデータ

Type: object.

Property説明Type
nameテンプレートフォルダ内のテンプレートのファイル名。拡張子なし。string
titleテンプレートのタイトル。翻訳可。string
postTypesこのカスタムテンプレートを使える投稿タイプのリスト。array

templateParts

パーツフォルダで定義されるテンプレートパーツの追加メタデータ。

Type: object.

Property説明Type
nameパーツフォルダ内のテンプレートのファイル名。拡張子なし。string
titleテンプレートのタイトル。翻訳可。string
areaテンプレートパーツが使用されるエリア。header 値と footer 値のブロックバリエーションが存在し、エリアがそのどちらかと設定された際に使用される。string

Patterns

パターンディレクトリから登録されるパターンのスラッグの配列。

Type: array.

原文

s
検索
c
新規投稿を作成する
r
返信
e
編集
t
ページのトップへ
j
次の投稿やコメントに移動
k
前の投稿やコメントに移動
o
コメントの表示を切替
esc
投稿やコメントの編集をキャンセル