Created
April 28, 2023 14:49
-
-
Save aslamatwebdevstudios/58990b3fb5c35ae29d8edfedb221bad8 to your computer and use it in GitHub Desktop.
Block specific custom styles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_theme_register_button_styles() { | |
wp_register_style( | |
'my-theme-button-styles', | |
get_stylesheet_directory_uri() . '/button-styles.css', | |
array(), | |
filemtime( get_stylesheet_directory() . '/button-styles.css' ) | |
); | |
register_block_style( | |
'core/button', | |
array( | |
'name' => 'my-theme-button-style', | |
'label' => __( 'My Button Style', 'my_theme' ), | |
'style_handle' => 'my-theme-button-styles', | |
'style' => 'my-theme-button-style', | |
) | |
); | |
} | |
add_action( 'init', 'my_theme_register_button_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment