register_block_style()
Registers a new block style.
Хуков нет.
Возвращает
true|false
. True if the block style was registered with success and false otherwise.
Использование
register_block_style( $block_name, $style_properties );
- $block_name(строка|string[]) (обязательный)
- Block type name including namespace or array of namespaced block type names.
- $style_properties(массив) (обязательный)
- Array containing the properties of the style name, label, style_handle (name of the stylesheet to be enqueued), inline_style (string containing the CSS to be added), style_data (theme.json-like array to generate CSS from). See WP_Block_Styles_Registry::register().
Список изменений
С версии 5.3.0 | Введена. |
С версии 6.6.0 | Added support for registering styles for multiple block types. |
Код register_block_style() register block style WP 6.7.1
function register_block_style( $block_name, $style_properties ) { return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties ); }