WP_Theme_JSON::get_custom_css()publicWP 6.2.0

Returns the global styles custom css.

Метод класса: WP_Theme_JSON{}

Хуков нет.

Возвращает

Строку. The global styles custom CSS.

Использование

$WP_Theme_JSON = new WP_Theme_JSON();
$WP_Theme_JSON->get_custom_css();

Список изменений

С версии 6.2.0 Введена.

Код WP_Theme_JSON::get_custom_css() WP 6.2.2

public function get_custom_css() {
	// Add the global styles root CSS.
	$stylesheet = _wp_array_get( $this->theme_json, array( 'styles', 'css' ), '' );

	// Add the global styles block CSS.
	if ( isset( $this->theme_json['styles']['blocks'] ) ) {
		foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) {
			$custom_block_css = _wp_array_get( $this->theme_json, array( 'styles', 'blocks', $name, 'css' ) );
			if ( $custom_block_css ) {
				$selector    = static::$blocks_metadata[ $name ]['selector'];
				$stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector );
			}
		}
	}

	return $stylesheet;
}