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

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

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

VersionDescription
6.2.0Introduced.

User Contributed Notes

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