WP_Theme_JSON::get_stylesheet( string $type = 'all' )

Returns the stylesheet that results of processing the theme.json structure this object represents.

Parameters

$type

(string) (Optional) Type of stylesheet we want. Accepts 'all', 'block_styles', and 'css_variables'.

Default value: 'all'

Return

(string) Stylesheet.

Source

File: wp-includes/class-wp-theme-json.php

public function get_stylesheet( $type = 'all' ) {
		$blocks_metadata = self::get_blocks_metadata();
		$style_nodes     = self::get_style_nodes( $this->theme_json, $blocks_metadata );
		$setting_nodes   = self::get_setting_nodes( $this->theme_json, $blocks_metadata );

		switch ( $type ) {
			case 'block_styles':
				return $this->get_block_styles( $style_nodes, $setting_nodes );
			case 'css_variables':
				return $this->get_css_variables( $setting_nodes );
			default:
				return $this->get_css_variables( $setting_nodes ) . $this->get_block_styles( $style_nodes, $setting_nodes );
		}

	}

Changelog

Version Description
5.8.0 Introduced.

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