Adds a single declaration.
$propertystringrequired
$valuestringrequired
public function add_declaration( $property, $value ) {
// Sanitizes the property.
$property = $this->sanitize_property( $property );
// Bails early if the property is empty.
if ( empty( $property ) ) {
return $this;
}
// Trims the value. If empty, bail early.
$value = trim( $value );
if ( '' === $value ) {
return $this;
}
// Adds the declaration property/value pair.
$this->declarations[ $property ] = $value;
return $this;
}
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_style_engine_css_declarations/add_declaration