Skip to content

Commit ebb7939

Browse files
committed
separate outline css to its own function
1 parent 5e8a960 commit ebb7939

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

functions.php

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,6 @@
2020
* @return void
2121
*/
2222
function twentytwentyfour_block_styles() {
23-
/**
24-
* The wp_enqueue_block_style() function allows us to enqueue a stylesheet
25-
* for a specific block. These will only get loaded when the block is rendered
26-
* (both in the editor and on the front end), improving performance
27-
* and reducing the amount of data requested by visitors.
28-
*
29-
* See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info.
30-
*/
31-
wp_enqueue_block_style(
32-
'core/button',
33-
array(
34-
'handle' => 'twentytwentyfour-button-style-outline',
35-
'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ),
36-
'ver' => wp_get_theme( get_template() )->get( 'Version' ),
37-
'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ),
38-
)
39-
);
4023

4124
register_block_style(
4225
'core/details',
@@ -164,6 +147,40 @@ function twentytwentyfour_block_styles() {
164147

165148
add_action( 'init', 'twentytwentyfour_block_styles' );
166149

150+
/**
151+
* Enqueue block stylesheets.
152+
*/
153+
154+
if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) :
155+
/**
156+
* Enqueue custom block stylesheets
157+
*
158+
* @since Twenty Twenty-Four 1.0
159+
* @return void
160+
*/
161+
function twentytwentyfour_block_stylesheets() {
162+
/**
163+
* The wp_enqueue_block_style() function allows us to enqueue a stylesheet
164+
* for a specific block. These will only get loaded when the block is rendered
165+
* (both in the editor and on the front end), improving performance
166+
* and reducing the amount of data requested by visitors.
167+
*
168+
* See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info.
169+
*/
170+
wp_enqueue_block_style(
171+
'core/button',
172+
array(
173+
'handle' => 'twentytwentyfour-button-style-outline',
174+
'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ),
175+
'ver' => wp_get_theme( get_template() )->get( 'Version' ),
176+
'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ),
177+
)
178+
);
179+
}
180+
endif;
181+
182+
add_action( 'init', 'twentytwentyfour_block_stylesheets' );
183+
167184
/**
168185
* Register pattern categories.
169186
*/

0 commit comments

Comments
 (0)