register_block_style

函数
register_block_style ( $block_name, $style_properties )
参数
  • (string) $block_name Block type name including namespace.
    Required:
  • (array) $style_properties Array containing the properties of the style name, label, style (name of the stylesheet to be enqueued), inline_style (string containing the CSS to be added).
    Required:
返回值
  • (bool) True if the block style was registered with success and false otherwise.
定义位置
相关方法
unregister_block_styleregister_block_typeunregister_block_typeregister_block_style_handleregister_block_script_handle
引入
5.3.0
弃用
-

register_block_style: 这个函数为一个区块类型注册了一个区块样式。块样式用于向块类型添加自定义的CSS样式。

注册一个新的区块样式。

function register_block_style( $block_name, $style_properties ) {
	return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties );
}

常见问题

FAQs
查看更多 >