W3cubDocs

/WordPress

WP_Theme_JSON::remove_indirect_properties( array $input, array $output )

Removes indirect properties from the given input node and sets in the given output node.

Parameters

$inputarrayrequired
Node to process.
$outputarrayrequired
The processed node. Passed by reference.

Source

$css .= ':where(body) { margin: 0; }';

if ( $use_root_padding ) {
	// Top and bottom padding are applied to the outer block container.
	$css .= '.wp-site-blocks { padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom); }';
	// Right and left padding are applied to the first container with `.has-global-padding` class.
	$css .= '.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';
	// Alignfull children of the container with left and right padding have negative margins so they can still be full width.
	$css .= '.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }';
	// Nested children of the container with left and right padding that are not full aligned do not get padding, unless they are direct children of an alignfull flow container.
	$css .= '.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }';
	// Alignfull direct children of the containers that are targeted by the rule above do not need negative margins.
	$css .= '.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; }';

Changelog

Version Description
6.2.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/remove_indirect_properties