method_block_theme_label_styles
apply_filters( 'method_block_theme_label_styles', mixed $styles )
Filters the label style options available in the Theme Button block.
Description
Registers named label style options that appear in a “Label Style” dropdown in the Theme Button block’s Inspector panel. Each style maps to a CSS class applied to the <span class="method-button-label"> element on the frontend.
When this filter returns false (the default), the label style selector is hidden entirely.
Parameters
$styles (array|false) :
An associative array where keys are CSS class names and values are display labels. Pass false to hide the control.
PHP
array(
'label-uppercase' => 'Uppercase',
'label-small-caps' => 'Small Caps',
'label-italic' => 'Italic',
)Source
PHP
'labelStyles' => apply_filters( 'method_block_theme_label_styles', $defaults ),File: lib/blocks/method-buttons/method-buttons.php, function method_theme_button_enqueue_block_assets()
Usage
PHP
add_filter( 'method_block_theme_label_styles', 'mytheme_label_styles' );
function mytheme_label_styles( $styles ) {
return array(
'' => 'Default',
'label-uppercase' => 'Uppercase',
'label-small-caps' => 'Small Caps',
);
}Notes
- The selected key is stored in the block’s
labelStyleattribute and added directly as a CSS class on the label<span>element:<span class="method-button-label {labelStyle}">. - Unlike
method_block_theme_button_styles, the key is used as‑is as a class name — no prefix is added. - You must define the corresponding CSS in your child theme’s stylesheet.
- The data is passed to the editor via
themeButtonData.labelStyles.
Related
method_block_theme_button_styles— Button wrapper style options- Buttons block
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |