WP_Theme_JSON::prepend_to_selector( string $selector, string $to_prepend ): string

In this article

Prepends a sub-selector to an existing one.

Description

Given the compounded $selector "h1, h2, h3" and the $to_prepend selector ".some-class " the result will be ".some-class h1, .some-class h2, .some-class h3".

Parameters

$selectorstringrequired
Original selector.
$to_prependstringrequired
Selector to prepend.

Return

string The new selector.

Source

 * @return array Theme json data with shared variation definitions unwrapped under appropriate block types.
 */
private static function unwrap_shared_block_style_variations( $theme_json, $valid_variations ) {
	if ( empty( $theme_json['styles']['variations'] ) || empty( $valid_variations ) ) {
		return $theme_json;
	}

	$new_theme_json = $theme_json;
	$variations     = $new_theme_json['styles']['variations'];

	foreach ( $valid_variations as $block_type => $registered_variations ) {

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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