Created
February 5, 2023 12:54
-
-
Save bahiirwa/900f611b2d3044f4487ead180ca540ec to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Add new h4 block style. | |
* Add custom styles and scripts support for the Block Theme. | |
* | |
* @package Safari_Block_Theme | |
*/ | |
if ( function_exists( 'register_block_style' ) ) { | |
register_block_style( | |
'core/heading', | |
array( | |
'name' => 'question', // WP will generate a style named - "is-style-question". | |
'label' => 'Question Style', | |
'inline_style' => 'question', | |
) | |
); | |
} | |
/** | |
* Add custom styles and scripts support for the Block Theme. | |
* | |
* @return void | |
*/ | |
function safaris_enqueue_scripts() { | |
$blockPath = '/css/blocks/h4.css'; | |
wp_enqueue_style( | |
'safaris-blocks-theme', | |
get_template_directory_uri() . $blockPath, | |
'', | |
filemtime(get_template_directory() . $blockPath), | |
'all' | |
); | |
} | |
// Adds the style to block editor backend only. | |
// add_action('enqueue_block_editor_assets', 'safaris_enqueue_scripts'); | |
// Adds the style to both the front and backend editor. | |
add_action('enqueue_block_assets', 'safaris_enqueue_scripts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment