[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)





/wp-includes/ -> style-engine.php (summary)

Style engine: Public functions This file contains a variety of public functions developers can use to interact with the Style Engine API.

File Size: 154 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions


Functions that are not part of a class:

wp_style_engine_get_styles( $block_styles, $options = array()   X-Ref
Global public interface method to generate styles from a single style object, e.g.,
the value of a block's attributes.style object or the top level styles in theme.json.
See: https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/#styles and

Example usage:

$styles = wp_style_engine_get_styles( array( 'color' => array( 'text' => '#cccccc' ) ) );
// Returns `array( 'css' => 'color: #cccccc', 'declarations' => array( 'color' => '#cccccc' ), 'classnames' => 'has-color' )`.

return: array {
param: array $block_styles The style object.
param: array $options {

wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = array()   X-Ref
Returns compiled CSS from a collection of selectors and declarations.
Useful for returning a compiled stylesheet from any collection of  CSS selector + declarations.

Example usage:
$css_rules = array( array( 'selector' => '.elephant-are-cool', 'declarations' => array( 'color' => 'gray', 'width' => '3em' ) ) );
$css       = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
// Returns `.elephant-are-cool{color:gray;width:3em}`.

return: string A string of compiled CSS declarations, or empty string.
param: array $css_rules {
param: array $options {

wp_style_engine_get_stylesheet_from_context( $context, $options = array()   X-Ref
Returns compiled CSS from a store, if found.

return: string A compiled CSS string.
param: string $context A valid context name, corresponding to an existing store key.
param: array  $options {

Generated : Fri Dec 2 08:20:02 2022 Cross-referenced by PHPXref