Gets a WP_Style_Engine_CSS_Rule object by its selector.
Description
If the rule does not exist, it will be created.
Parameters
$selector
stringrequired- The CSS selector.
Source
public function add_rule( $selector ) {
$selector = trim( $selector );
// Bail early if there is no selector.
if ( empty( $selector ) ) {
return;
}
// Create the rule if it doesn't exist.
if ( empty( $this->rules[ $selector ] ) ) {
$this->rules[ $selector ] = new WP_Style_Engine_CSS_Rule( $selector );
}
return $this->rules[ $selector ];
}
Changelog
Version | Description |
---|---|
6.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.