WP_Theme_JSON::append_to_selector( string $selector, string $to_append )
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Function that appends a sub-selector to a existing one.
Description
Given the compounded $selector "h1, h2, h3" and the $to_append selector ".some-class" the result will be "h1.some-class, h2.some-class, h3.some-class".
Parameters
- $selector
-
(string) (Required) Original selector.
- $to_append
-
(string) (Required) Selector to append.
Return
(string)
Source
File: wp-includes/class-wp-theme-json.php
private static function append_to_selector( $selector, $to_append ) { $new_selectors = array(); $selectors = explode( ',', $selector ); foreach ( $selectors as $sel ) { $new_selectors[] = $sel . $to_append; } return implode( ',', $new_selectors ); }
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/append_to_selector