|
20 | 20 | * @return void |
21 | 21 | */ |
22 | 22 | 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 | | - ); |
40 | 23 |
|
41 | 24 | register_block_style( |
42 | 25 | 'core/details', |
@@ -164,6 +147,40 @@ function twentytwentyfour_block_styles() { |
164 | 147 |
|
165 | 148 | add_action( 'init', 'twentytwentyfour_block_styles' ); |
166 | 149 |
|
| 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 | + |
167 | 184 | /** |
168 | 185 | * Register pattern categories. |
169 | 186 | */ |
|
0 commit comments