PluginProbe
Gutenberg / 14.7.0
Gutenberg v14.7.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / lib / compat / wordpress-6.2 / block-patterns.php

block-patterns.php in Gutenberg 14.7.0, at lib/compat/wordpress-6.2/block-patterns.php

121 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Overrides Core's wp-includes/block-patterns.php to add category descriptions for WP 6.2.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * Registers the block pattern categories.
10 */
11 function gutenberg_register_core_block_patterns_and_categories() {
12 register_block_pattern_category(
13 'banner',
14 array(
15 'label' => _x( 'Banners', 'Block pattern category', 'gutenberg' ),
16 )
17 );
18 register_block_pattern_category(
19 'buttons',
20 array(
21 'label' => _x( 'Buttons', 'Block pattern category', 'gutenberg' ),
22 'description' => __( 'Patterns that contain buttons and call to actions.', 'gutenberg' ),
23 )
24 );
25 register_block_pattern_category(
26 'columns',
27 array(
28 'label' => _x( 'Columns', 'Block pattern category', 'gutenberg' ),
29 'description' => __( 'Multi-column patterns with more complex layouts.', 'gutenberg' ),
30 )
31 );
32 register_block_pattern_category(
33 'footer',
34 array(
35 'label' => _x( 'Footers', 'Block pattern category', 'gutenberg' ),
36 'description' => __( 'A variety of footer designs displaying information and site navigation.', 'gutenberg' ),
37 )
38 );
39 register_block_pattern_category(
40 'gallery',
41 array(
42 'label' => _x( 'Gallery', 'Block pattern category', 'gutenberg' ),
43 'description' => __( 'Patterns containing mostly images or other media.', 'gutenberg' ),
44 )
45 );
46 register_block_pattern_category(
47 'header',
48 array(
49 'label' => _x( 'Headers', 'Block pattern category', 'gutenberg' ),
50 'description' => __( 'A variety of header designs displaying your site title and navigation.', 'gutenberg' ),
51 )
52 );
53 register_block_pattern_category(
54 'text',
55 array(
56 'label' => _x( 'Text', 'Block pattern category', 'gutenberg' ),
57 'description' => __( 'Patterns containing mostly text.', 'gutenberg' ),
58 )
59 );
60 register_block_pattern_category(
61 'query',
62 array(
63 'label' => _x( 'Posts', 'Block pattern category', 'gutenberg' ),
64 'description' => __( 'Display your latest posts in lists, grids or other layouts.', 'gutenberg' ),
65 )
66 );
67 register_block_pattern_category(
68 'featured',
69 array(
70 'label' => _x( 'Featured', 'Block pattern category', 'gutenberg' ),
71 'description' => __( 'A set of high quality curated patterns.', 'gutenberg' ),
72 )
73 );
74 }
75 add_action( 'init', 'gutenberg_register_core_block_patterns_and_categories' );
76
77 /**
78 * Registers Gutenberg-bundled patterns, with a focus on headers and footers
79 * for site editing.
80 *
81 * @since 6.2.0
82 * @access private
83 */
84 function gutenberg_register_core_block_patterns() {
85 if ( ! get_theme_support( 'core-block-patterns' ) ) {
86 return;
87 }
88
89 $core_block_patterns = array(
90 'centered-footer',
91 'centered-footer-with-social-links',
92 'centered-header',
93 'centered-logo-in-navigation',
94 'footer-with-background-color-and-three-columns',
95 'footer-with-credit-line-and-navigation',
96 'footer-with-large-font-size',
97 'footer-with-navigation-and-credit-line',
98 'footer-with-search-site-title-and-credit-line',
99 'footer-with-site-title-and-credit-line',
100 'header-with-large-font-size',
101 'left-aligned-footer',
102 'right-aligned-footer',
103 'simple-header',
104 'simple-header-inside-image',
105 'simple-header-with-background-color',
106 'simple-header-with-image',
107 'simple-header-with-tagline',
108 'simple-header-with-tagline-2',
109 'site-title-and-menu-button',
110 'site-title-and-vertical-navigation',
111 );
112
113 foreach ( $core_block_patterns as $core_block_pattern ) {
114 register_block_pattern(
115 'core/' . $core_block_pattern,
116 require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php'
117 );
118 }
119 }
120 add_action( 'init', 'gutenberg_register_core_block_patterns' );
121