Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bahiirwa/900f611b2d3044f4487ead180ca540ec to your computer and use it in GitHub Desktop.
Save bahiirwa/900f611b2d3044f4487ead180ca540ec to your computer and use it in GitHub Desktop.
<?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