[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentytwentytwo/inc/ -> block-patterns.php (source)

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


Generated : Sat Aug 15 08:20:25 2026 Cross-referenced by PHPXref