WP_Theme_JSON::process_blocks_custom_css()
Processes the CSS, to apply nesting.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Строку
. The processed CSS.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->process_blocks_custom_css( $css, $selector );
- $css(строка) (обязательный)
- The CSS to process.
- $selector(строка) (обязательный)
- The selector to nest.
Список изменений
С версии 6.2.0 | Введена. |
Код WP_Theme_JSON::process_blocks_custom_css() WP Theme JSON::process blocks custom css WP 6.2.2
protected function process_blocks_custom_css( $css, $selector ) { $processed_css = ''; // Split CSS nested rules. $parts = explode( '&', $css ); foreach ( $parts as $part ) { $processed_css .= ( ! str_contains( $part, '{' ) ) ? trim( $selector ) . '{' . trim( $part ) . '}' // If the part doesn't contain braces, it applies to the root level. : trim( $selector . $part ); // Prepend the selector, which effectively replaces the "&" character. } return $processed_css; }