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 を使用した開発を参照してください。

Top ↑

settings

Top ↑

appearanceTools

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

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

Top ↑

useRootPaddingAwareAlignments

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

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


Top ↑

border

ボーダー関連の設定。

PropertyTypeDefaultProps
colorbooleanfalse
radiusbooleanfalse
stylebooleanfalse
widthbooleanfalse

Top ↑

shadow

シャドー関連の設定。

PropertyTypeDefaultProps
defaultPresetsbooleantrue
presetsarrayname, shadow, slug

Top ↑

color

色関連の設定。

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

Top ↑

background

背景関連の設定。

PropertyTypeDefaultProps
backgroundImagebooleanfalse

Top ↑

dimensions

寸法関連の設定。

PropertyTypeDefaultProps
aspectRatiobooleanfalse
minHeightbooleanfalse

Top ↑

layout

レイアウト関連の設定。

PropertyTypeDefaultProps
contentSizestring
wideSizestring
allowEditingbooleantrue
allowCustomContentAndWideSizebooleantrue

Top ↑

lightbox 関連の設定。

PropertyTypeDefaultProps
enabledboolean
allowEditingboolean

Top ↑

position

位置関連の設定。

PropertyTypeDefaultProps
stickybooleanfalse

Top ↑

spacing

スペース関連の設定。

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

Top ↑

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

Top ↑

custom

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


Top ↑

Styles

Top ↑

border

ボーダーのスタイル。

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

Top ↑

color

色のスタイル。

PropertyTypeProps
backgroundstring, object
gradientstring, object
textstring, object

Top ↑

dimensions

寸法のスタイル

PropertyTypeProps
aspectRatiostring, object
minHeightstring, object

Top ↑

spacing

スペースのスタイル。

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

Top ↑

typography

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

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

Top ↑

filter

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

PropertyTypeProps
duotonestring, object

Top ↑

shadow

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


Top ↑

outline

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

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

Top ↑

css

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


Top ↑

customTemplates

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

Type: object.

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

Top ↑

templateParts

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

Type: object.

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

Top ↑

Patterns

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

Type: array.

原文

最終更新日: