Skip to content
This repository has been archived by the owner on Feb 17, 2025. It is now read-only.

Archeo: Load patterns automatically #5715

Merged
merged 9 commits into from
Apr 1, 2022
42 changes: 40 additions & 2 deletions archeo/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,43 @@ function archeo_styles() {

add_action( 'wp_enqueue_scripts', 'archeo_styles' );

// Add block patterns
require get_template_directory() . '/inc/block-patterns.php';
/**
* Registers block patterns and categories.
*
* @since Archeo 1.0
*
* @return void
*/
function archeo_register_block_pattern_categories() {
$block_pattern_categories = array(
'images' => array( 'label' => __( 'Images', 'archeo' ) ),
'featured' => array( 'label' => __( 'Featured', 'archeo' ) ),
'footer' => array( 'label' => __( 'Footers', 'archeo' ) ),
'query' => array( 'label' => __( 'Query', 'archeo' ) ),
);

/**
* Filters the theme block pattern categories.
*
* @since archeo 1.0
*
* @param array[] $block_pattern_categories {
* An associative array of block pattern categories, keyed by category name.
*
* @type array[] $properties {
* An array of block category properties.
*
* @type string $label A human-readable label for the pattern category.
* }
* }
*/
$block_pattern_categories = apply_filters( 'archeo_block_pattern_categories', $block_pattern_categories );

foreach ( $block_pattern_categories as $name => $properties ) {
if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
register_block_pattern_category( $name, $properties );
}
}

}
add_action( 'init', 'archeo_register_block_patterns', 9 );
79 changes: 0 additions & 79 deletions archeo/inc/block-patterns.php

This file was deleted.

24 changes: 0 additions & 24 deletions archeo/inc/patterns/footer.php

This file was deleted.

13 changes: 0 additions & 13 deletions archeo/inc/patterns/headline-over-dark-image.php

This file was deleted.

24 changes: 0 additions & 24 deletions archeo/inc/patterns/hidden-404.php

This file was deleted.

This file was deleted.

31 changes: 0 additions & 31 deletions archeo/inc/patterns/image-with-description.php

This file was deleted.

31 changes: 0 additions & 31 deletions archeo/inc/patterns/image-with-headline-description.php

This file was deleted.

17 changes: 0 additions & 17 deletions archeo/inc/patterns/image-with-headline-on-dark-background.php

This file was deleted.

23 changes: 0 additions & 23 deletions archeo/inc/patterns/image-with-headline-separate-description.php

This file was deleted.

Loading