[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

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


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1