Function to enqueue stylesheet from each LazyBlock
-
Hello, first of all, thank you for the really great Plugin!
I had a function to enqueue each LazyBlocks individual Stylesheet, which seems to have stopped working after updating to WordPress 6.2.
Each of the Lazyblock folders includes a block.php as well as a block-style.css file.My code is as follows:
/** * Enque block styles */ add_action('after_setup_theme', 'watzek_enqueue_block_styles'); function watzek_enqueue_block_styles() { $folderPath = get_template_directory() . "/blocks"; $block_names = array_diff(scandir($folderPath), array('..', '.')); foreach ($block_names as $block_name) { wp_enqueue_block_style('lazyblock/' . $block_name, array( 'handle' => $block_name, 'src' => get_theme_file_uri('blocks/' . $block_name . '/block-style.css'), )); } }
Maybe somebody has an idea what could be wrong with my code?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Function to enqueue stylesheet from each LazyBlock’ is closed to new replies.