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

Skatepark: refactor patterns to load directly from the editor #5858

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions skatepark/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,47 @@ function skatepark_preload_webfonts() {

add_action( 'wp_head', 'skatepark_preload_webfonts' );

// Add block patterns
require get_template_directory() . '/inc/block-patterns.php';
/**
* Registers block patterns and categories.
*
* @since Skatepark 1.0
*
* @return void
*/
function skatepark_register_block_pattern_categories() {

//Needed until https://github.com/WordPress/gutenberg/issues/39500 is fixed.
$block_pattern_categories = array(
'featured' => array( 'label' => __( 'Featured', 'skatepark' ) ),
'columns' => array( 'label' => __( 'Columns', 'skatepark' ) ),
'images' => array( 'label' => __( 'Images', 'skatepark' ) ),
'text' => array( 'label' => __( 'Text', 'skatepark' ) ),
'query' => array( 'label' => __( 'Query', 'skatepark' ) ),
);

/**
* Filters the theme block pattern categories.
*
* @since Skatepark 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( 'skatepark_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', 'skatepark_register_block_pattern_categories', 9 );

43 changes: 0 additions & 43 deletions skatepark/inc/block-patterns.php

This file was deleted.

37 changes: 0 additions & 37 deletions skatepark/inc/patterns/blog-posts.php

This file was deleted.

54 changes: 0 additions & 54 deletions skatepark/inc/patterns/columns-in-container.php

This file was deleted.

29 changes: 0 additions & 29 deletions skatepark/inc/patterns/full-width-image-with-aside-caption.php

This file was deleted.

19 changes: 0 additions & 19 deletions skatepark/inc/patterns/hidden-404.php

This file was deleted.

54 changes: 0 additions & 54 deletions skatepark/inc/patterns/hidden-home-patterns.php

This file was deleted.

92 changes: 0 additions & 92 deletions skatepark/inc/patterns/mixed-media-in-container.php

This file was deleted.

Loading