WP_Theme_JSON::scope_selector( string $scope, string $selector ): string

In this article

Function that scopes a selector with another one. This works a bit like SCSS nesting except the & operator isn’t supported.

Description

$scope = '.a, .b .c';
$selector = '> .x, .y';
$merged = scope_selector( $scope, $selector );
// $merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'

Parameters

$scopestringrequired
Selector to scope to.
$selectorstringrequired
Original selector.

Return

string Scoped selector.

Source

}

/**
 * Converts each styles section into a list of rulesets
 * to be appended to the stylesheet.
 * These rulesets contain all the css variables (custom variables and preset variables).
 *
 * See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax
 *
 * For each section this creates a new ruleset such as:
 *
 *     block-selector {
 *       --wp--preset--category--slug: value;
 *       --wp--custom--variable: value;
 *     }
 *
 * @since 5.8.0
 * @since 5.9.0 Added the `$origins` parameter.
 *
 * @param array    $nodes   Nodes with settings.
 * @param string[] $origins List of origins to process.
 * @return string The new stylesheet.

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

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