WP_Theme_JSON::__construct( array $theme_json = array(), string $origin = ‘theme’ )

In this article

Constructor.

Parameters

$theme_jsonarrayoptional
A structure that follows the theme.json schema.

Default:array()

$originstringoptional
What source of data this object represents.
One of 'default', 'theme', or 'custom'. Default 'theme'.

Default:'theme'

Source

 * @since 6.1.0 Added `heading`, `button`, and `caption` elements.
 * @var string[]
 */
const ELEMENTS = array(
	'link'    => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity.
	'heading' => 'h1, h2, h3, h4, h5, h6',
	'h1'      => 'h1',
	'h2'      => 'h2',
	'h3'      => 'h3',
	'h4'      => 'h4',
	'h5'      => 'h5',
	'h6'      => 'h6',
	// We have the .wp-block-button__link class so that this will target older buttons that have been serialized.
	'button'  => '.wp-element-button, .wp-block-button__link',
	// The block classes are necessary to target older content that won't use the new class names.
	'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption',
	'cite'    => 'cite',
);

const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array(
	'button'  => 'wp-element-button',
	'caption' => 'wp-element-caption',
);

/**
 * List of block support features that can have their related styles
 * generated under their own feature level selector rather than the block's.
 *
 * @since 6.1.0
 * @var string[]
 */
const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = array(
	'__experimentalBorder' => 'border',
	'color'                => 'color',
	'spacing'              => 'spacing',
	'typography'           => 'typography',

Changelog

VersionDescription
5.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.