From ebb79398aa67c251334154b9921320123ce75f53 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Fri, 3 Nov 2023 10:15:11 +0100 Subject: [PATCH 1/2] separate outline css to its own function --- functions.php | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/functions.php b/functions.php index 2dbd0535..43f281c7 100644 --- a/functions.php +++ b/functions.php @@ -20,23 +20,6 @@ * @return void */ function twentytwentyfour_block_styles() { - /** - * The wp_enqueue_block_style() function allows us to enqueue a stylesheet - * for a specific block. These will only get loaded when the block is rendered - * (both in the editor and on the front end), improving performance - * and reducing the amount of data requested by visitors. - * - * See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info. - */ - wp_enqueue_block_style( - 'core/button', - array( - 'handle' => 'twentytwentyfour-button-style-outline', - 'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ), - 'ver' => wp_get_theme( get_template() )->get( 'Version' ), - 'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ), - ) - ); register_block_style( 'core/details', @@ -164,6 +147,40 @@ function twentytwentyfour_block_styles() { add_action( 'init', 'twentytwentyfour_block_styles' ); +/** + * Enqueue block stylesheets. + */ + + if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) : + /** + * Enqueue custom block stylesheets + * + * @since Twenty Twenty-Four 1.0 + * @return void + */ + function twentytwentyfour_block_stylesheets() { + /** + * The wp_enqueue_block_style() function allows us to enqueue a stylesheet + * for a specific block. These will only get loaded when the block is rendered + * (both in the editor and on the front end), improving performance + * and reducing the amount of data requested by visitors. + * + * See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info. + */ + wp_enqueue_block_style( + 'core/button', + array( + 'handle' => 'twentytwentyfour-button-style-outline', + 'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ), + 'ver' => wp_get_theme( get_template() )->get( 'Version' ), + 'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ), + ) + ); + } +endif; + +add_action( 'init', 'twentytwentyfour_block_stylesheets' ); + /** * Register pattern categories. */ From 313c7e349418e4d71965730c7d6bcabc54a68250 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Fri, 3 Nov 2023 10:18:14 +0100 Subject: [PATCH 2/2] linting --- functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 43f281c7..7406ea93 100644 --- a/functions.php +++ b/functions.php @@ -151,7 +151,7 @@ function twentytwentyfour_block_styles() { * Enqueue block stylesheets. */ - if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) : +if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) : /** * Enqueue custom block stylesheets *