- Timestamp:
- 11/19/2021 08:12:44 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwentytwo/inc/block-patterns.php
r52081 r52222 6 6 */ 7 7 8 if ( ! function_exists( 'twentytwentytwo_register_block_patterns' ) ) : 8 /** 9 * Registers block patterns and categories. 10 * 11 * @since Twenty Twenty-Two 1.0 12 */ 13 function twentytwentytwo_register_block_patterns() { 14 $block_pattern_categories = array( 15 'twentytwentytwo-general' => array( 'label' => __( 'Twenty Twenty-Two General', 'twentytwentytwo' ) ), 16 'twentytwentytwo-footers' => array( 'label' => __( 'Twenty Twenty-Two Footers', 'twentytwentytwo' ) ), 17 'twentytwentytwo-headers' => array( 'label' => __( 'Twenty Twenty-Two Headers', 'twentytwentytwo' ) ), 18 'twentytwentytwo-query' => array( 'label' => __( 'Twenty Twenty-Two Posts', 'twentytwentytwo' ) ), 19 'twentytwentytwo-pages' => array( 'label' => __( 'Twenty Twenty-Two Pages', 'twentytwentytwo' ) ), 20 ); 21 9 22 /** 10 * Registers block patterns andcategories.23 * Filters the theme block pattern categories. 11 24 * 12 25 * @since Twenty Twenty-Two 1.0 26 * 27 * @param array[] $block_pattern_categories { 28 * An associative array of block pattern categories, keyed by category name. 29 * 30 * @type array[] $properties { 31 * An array of block category properties. 32 * 33 * @type string $label A human-readable label for the pattern category. 34 * } 35 * } 13 36 */ 14 function twentytwentytwo_register_block_patterns() {37 $block_pattern_categories = apply_filters( 'twentytwentytwo_block_pattern_categories', $block_pattern_categories ); 15 38 16 register_block_pattern_category( 17 'twentytwentytwo-general', 18 array( 'label' => __( 'Twenty Twenty-Two General', 'twentytwentytwo' ) ) 39 foreach ( $block_pattern_categories as $name => $properties ) { 40 register_block_pattern_category( $name, $properties ); 41 } 42 43 $block_patterns = array( 44 'footer-default', 45 'footer-dark', 46 'footer-logo', 47 'footer-navigation', 48 'footer-title-tagline-social', 49 'footer-social-copyright', 50 'footer-navigation-copyright', 51 'footer-about-title-logo', 52 'footer-query-title-citation', 53 'footer-query-images-title-citation', 54 'footer-blog', 55 'general-subscribe', 56 'general-featured-posts', 57 'general-layered-images-with-duotone', 58 'general-wide-image-intro-buttons', 59 'general-large-list-names', 60 'general-video-header-details', 61 'general-list-events', 62 'general-two-images-text', 63 'general-image-with-caption', 64 'general-video-trailer', 65 'general-pricing-table', 66 'general-divider-light', 67 'general-divider-dark', 68 'header-default', 69 'header-large-dark', 70 'header-small-dark', 71 'header-image-background', 72 'header-image-background-overlay', 73 'header-with-tagline', 74 'header-text-only-green-background', 75 'header-text-only-salmon-background', 76 'header-title-and-button', 77 'header-text-only-with-tagline-black-background', 78 'header-logo-navigation-gray-background', 79 'header-logo-navigation-social-black-background', 80 'header-title-navigation-social', 81 'header-logo-navigation-offset-tagline', 82 'header-stacked', 83 'header-centered-logo', 84 'header-centered-logo-black-background', 85 'header-centered-title-navigation-social', 86 'header-title-and-button', 87 'hidden-404', 88 'hidden-bird', 89 'hidden-heading-and-bird', 90 'page-about-media-left', 91 'page-about-simple-dark', 92 'page-about-media-right', 93 'page-about-solid-color', 94 'page-about-links', 95 'page-about-links-dark', 96 'page-about-large-image-and-buttons', 97 'page-layout-image-and-text', 98 'page-layout-image-text-and-video', 99 'page-layout-two-columns', 100 'page-sidebar-poster', 101 'page-sidebar-grid-posts', 102 'page-sidebar-blog-posts', 103 'page-sidebar-blog-posts-right', 104 'query-default', 105 'query-simple-blog', 106 'query-grid', 107 'query-text-grid', 108 'query-image-grid', 109 'query-large-titles', 110 'query-irregular-grid', 111 ); 112 113 /** 114 * Filters the theme block patterns. 115 * 116 * @since Twenty Twenty-Two 1.0 117 * 118 * @param $block_patterns array List of block patterns by name. 119 */ 120 $block_patterns = apply_filters( 'twentytwentytwo_block_patterns', $block_patterns ); 121 122 foreach ( $block_patterns as $block_pattern ) { 123 register_block_pattern( 124 'twentytwentytwo/' . $block_pattern, 125 require __DIR__ . '/patterns/' . $block_pattern . '.php' 19 126 ); 20 register_block_pattern_category(21 'twentytwentytwo-footers',22 array( 'label' => __( 'Twenty Twenty-Two Footers', 'twentytwentytwo' ) )23 );24 register_block_pattern_category(25 'twentytwentytwo-headers',26 array( 'label' => __( 'Twenty Twenty-Two Headers', 'twentytwentytwo' ) )27 );28 register_block_pattern_category(29 'twentytwentytwo-query',30 array( 'label' => __( 'Twenty Twenty-Two Posts', 'twentytwentytwo' ) )31 );32 register_block_pattern_category(33 'twentytwentytwo-pages',34 array( 'label' => __( 'Twenty Twenty-Two Pages', 'twentytwentytwo' ) )35 );36 37 $block_patterns = array(38 'footer-default',39 'footer-dark',40 'footer-logo',41 'footer-navigation',42 'footer-title-tagline-social',43 'footer-title-tagline-social-dark',44 'footer-social-copyright',45 'footer-navigation-copyright',46 'footer-about-title-logo',47 'footer-query-title-citation',48 'footer-query-images-title-citation',49 'footer-blog',50 'general-subscribe',51 'general-featured-posts',52 'general-layered-images-with-duotone',53 'general-wide-image-intro-buttons',54 'general-large-list-names',55 'general-video-header-details',56 'general-list-events',57 'general-two-images-text',58 'general-image-with-caption',59 'general-video-trailer',60 'general-pricing-table',61 'general-divider-light',62 'general-divider-dark',63 'header-default',64 'header-large-dark',65 'header-image-background',66 'header-image-background-overlay',67 'header-with-tagline',68 'header-text-only-green-background',69 'header-text-only-salmon-background',70 'header-title-and-button',71 'header-text-only-with-tagline-black-background',72 'header-logo-navigation-gray-background',73 'header-logo-navigation-social-black-background',74 'header-title-navigation-social',75 'header-logo-navigation-offset-tagline',76 'header-stacked',77 'header-centered-logo',78 'header-centered-logo-black-background',79 'header-centered-title-navigation-social',80 'header-title-and-button',81 'hidden-404',82 'hidden-heading-and-bird',83 'page-about-big-image-and-buttons',84 'page-about-media-left',85 'page-about-simple-dark',86 'page-about-media-right',87 'page-about-links',88 'page-about-links-dark',89 'page-layout-image-and-text',90 'page-layout-image-text-and-video',91 'page-layout-two-columns',92 'page-sidebar-poster',93 'page-sidebar-grid-posts',94 'page-sidebar-blog-posts',95 'page-sidebar-blog-posts-right',96 'query-default',97 'query-simple-blog',98 'query-grid',99 'query-text-grid',100 'query-image-grid',101 'query-large-titles',102 'query-irregular-grid',103 );104 105 foreach ( $block_patterns as $block_pattern ) {106 register_block_pattern(107 'twentytwentytwo/' . $block_pattern,108 require __DIR__ . '/patterns/' . $block_pattern . '.php'109 );110 }111 127 } 112 endif; 128 } 113 129 add_action( 'init', 'twentytwentytwo_register_block_patterns', 9 );
Note: See TracChangeset
for help on using the changeset viewer.