equal
deleted
inserted
replaced
|
1 <?php |
|
2 /** |
|
3 * Register the block patterns and block patterns categories |
|
4 * |
|
5 * @package WordPress |
|
6 * @since 5.5.0 |
|
7 */ |
|
8 |
|
9 add_theme_support( 'core-block-patterns' ); |
|
10 |
|
11 /** |
|
12 * Registers the core block patterns and categories. |
|
13 * |
|
14 * @since 5.5.0 |
|
15 * @private |
|
16 */ |
|
17 function _register_core_block_patterns_and_categories() { |
|
18 $should_register_core_patterns = get_theme_support( 'core-block-patterns' ); |
|
19 |
|
20 if ( $should_register_core_patterns ) { |
|
21 $core_block_patterns = array( |
|
22 'text-two-columns', |
|
23 'two-buttons', |
|
24 'two-images', |
|
25 'text-two-columns-with-images', |
|
26 'text-three-columns-buttons', |
|
27 'large-header', |
|
28 'large-header-button', |
|
29 'three-buttons', |
|
30 'heading-paragraph', |
|
31 'quote', |
|
32 ); |
|
33 |
|
34 foreach ( $core_block_patterns as $core_block_pattern ) { |
|
35 register_block_pattern( |
|
36 'core/' . $core_block_pattern, |
|
37 require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php' |
|
38 ); |
|
39 } |
|
40 } |
|
41 |
|
42 register_block_pattern_category( 'buttons', array( 'label' => _x( 'Buttons', 'Block pattern category' ) ) ); |
|
43 register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category' ) ) ); |
|
44 register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category' ) ) ); |
|
45 register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category' ) ) ); |
|
46 register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category' ) ) ); |
|
47 } |