From 13ad6f6bd91c06f396286261d9701db59a23777a Mon Sep 17 00:00:00 2001 From: Maggie Date: Tue, 15 Mar 2022 11:26:19 +0100 Subject: [PATCH 1/4] removed categories and reasigned patterns to default ones --- remote/inc/block-patterns.php | 26 ---------------------- remote/inc/patterns/hero-text.php | 2 +- remote/inc/patterns/hidden-search-form.php | 7 +++--- remote/inc/patterns/posts-list.php | 2 +- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/remote/inc/block-patterns.php b/remote/inc/block-patterns.php index 9dda88f894..dba0519d7a 100644 --- a/remote/inc/block-patterns.php +++ b/remote/inc/block-patterns.php @@ -13,32 +13,6 @@ * @return void */ function remote_register_block_patterns() { - $block_pattern_categories = array( - 'pages' => array( 'label' => __( 'Pages', 'remote' ) ), - ); - - /** - * Filters the theme block pattern categories. - * - * @since remote 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( 'remote_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 ); - } - } $block_patterns = array( 'hero-text', diff --git a/remote/inc/patterns/hero-text.php b/remote/inc/patterns/hero-text.php index 628d836f73..6806ada637 100644 --- a/remote/inc/patterns/hero-text.php +++ b/remote/inc/patterns/hero-text.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Hero text', 'remote' ), - 'categories' => array( 'pages' ), + 'categories' => array( 'text' ), 'content' => '
diff --git a/remote/inc/patterns/hidden-search-form.php b/remote/inc/patterns/hidden-search-form.php index 216d4bb409..bf699ac73e 100644 --- a/remote/inc/patterns/hidden-search-form.php +++ b/remote/inc/patterns/hidden-search-form.php @@ -3,10 +3,9 @@ * Search form */ return array( - 'title' => __( 'Search form', 'remote' ), - 'categories' => array( 'pages' ), - 'inserter' => false, - 'content' => ' + 'title' => __( 'Search form', 'remote' ), + 'inserter' => false, + 'content' => '
diff --git a/remote/inc/patterns/posts-list.php b/remote/inc/patterns/posts-list.php index e23ec20ee3..6775afbefe 100644 --- a/remote/inc/patterns/posts-list.php +++ b/remote/inc/patterns/posts-list.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Posts list', 'remote' ), - 'categories' => array( 'pages' ), + 'categories' => array( 'query' ), 'content' => '
From e4ae9e1393ddfdbaffc8af753ae1a5e329f6a83f Mon Sep 17 00:00:00 2001 From: Maggie Date: Wed, 16 Mar 2022 13:14:58 +0100 Subject: [PATCH 2/4] added patterns to featured category --- remote/inc/patterns/categories.php | 2 +- remote/inc/patterns/hero-text.php | 2 +- remote/inc/patterns/image-with-text.php | 2 +- remote/inc/patterns/posts-grid.php | 2 +- remote/inc/patterns/posts-list.php | 2 +- remote/inc/patterns/tags.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/remote/inc/patterns/categories.php b/remote/inc/patterns/categories.php index 66aa5d68fa..44bec9393b 100644 --- a/remote/inc/patterns/categories.php +++ b/remote/inc/patterns/categories.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Categories', 'remote' ), - 'categories' => array( 'text' ), + 'categories' => array( 'text', 'featured' ), 'content' => '

' . esc_html__( 'Categories', 'remote' ) . '

diff --git a/remote/inc/patterns/hero-text.php b/remote/inc/patterns/hero-text.php index 6806ada637..2a2e22557c 100644 --- a/remote/inc/patterns/hero-text.php +++ b/remote/inc/patterns/hero-text.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Hero text', 'remote' ), - 'categories' => array( 'text' ), + 'categories' => array( 'text', 'featured' ), 'content' => '
diff --git a/remote/inc/patterns/image-with-text.php b/remote/inc/patterns/image-with-text.php index 7a0b88be1d..8ab9946b6d 100644 --- a/remote/inc/patterns/image-with-text.php +++ b/remote/inc/patterns/image-with-text.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Image with text', 'remote' ), - 'categories' => array( 'text', 'columns' ), + 'categories' => array( 'text', 'columns', 'featured' ), 'content' => '
' . esc_attr__( 'Picture of a laptop', 'remote' ) . '
diff --git a/remote/inc/patterns/posts-grid.php b/remote/inc/patterns/posts-grid.php index 52968dfc30..f3525a0d9e 100644 --- a/remote/inc/patterns/posts-grid.php +++ b/remote/inc/patterns/posts-grid.php @@ -7,7 +7,7 @@ return array( 'title' => __( 'Posts grid', 'remote' ), - 'categories' => array( 'query' ), + 'categories' => array( 'query', 'featured' ), 'blockTypes' => array( 'core/query' ), 'content' => '
diff --git a/remote/inc/patterns/posts-list.php b/remote/inc/patterns/posts-list.php index 6775afbefe..b0dee7c05b 100644 --- a/remote/inc/patterns/posts-list.php +++ b/remote/inc/patterns/posts-list.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Posts list', 'remote' ), - 'categories' => array( 'query' ), + 'categories' => array( 'query', 'featured' ), 'content' => '
diff --git a/remote/inc/patterns/tags.php b/remote/inc/patterns/tags.php index 3aaddbb930..9c04120657 100644 --- a/remote/inc/patterns/tags.php +++ b/remote/inc/patterns/tags.php @@ -4,7 +4,7 @@ */ return array( 'title' => __( 'Tags', 'remote' ), - 'categories' => array( 'text' ), + 'categories' => array( 'text', 'featured' ), 'content' => '

' . esc_html__( 'Tags', 'remote' ) . '

From e97bc457519a83abe90e6dbb492cfed93e92b5a3 Mon Sep 17 00:00:00 2001 From: Maggie Date: Wed, 16 Mar 2022 13:18:10 +0100 Subject: [PATCH 3/4] re register pattern categories --- remote/inc/block-patterns.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/remote/inc/block-patterns.php b/remote/inc/block-patterns.php index dba0519d7a..c9389e66cc 100644 --- a/remote/inc/block-patterns.php +++ b/remote/inc/block-patterns.php @@ -14,6 +14,36 @@ */ function remote_register_block_patterns() { + $block_pattern_categories = array( + 'featured' => array( 'label' => __( 'Featured', 'remote' ) ), + 'columns' => array( 'label' => __( 'Columns', 'remote' ) ), + 'text' => array( 'label' => __( 'Text', 'remote' ) ), + 'query' => array( 'label' => __( 'Query', 'remote' ) ), + ); + + /** + * Filters the theme block pattern categories. + * + * @since remote 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( 'remote_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 ); + } + } + $block_patterns = array( 'hero-text', 'hidden-404-content', From a77f78ef86408cfce0131d60575940395c4eff89 Mon Sep 17 00:00:00 2001 From: Maggie Date: Wed, 16 Mar 2022 13:26:25 +0100 Subject: [PATCH 4/4] added a comment about GB issue --- remote/inc/block-patterns.php | 1 + 1 file changed, 1 insertion(+) diff --git a/remote/inc/block-patterns.php b/remote/inc/block-patterns.php index c9389e66cc..e58b241ee3 100644 --- a/remote/inc/block-patterns.php +++ b/remote/inc/block-patterns.php @@ -14,6 +14,7 @@ */ function remote_register_block_patterns() { + //Needed until https://github.com/WordPress/gutenberg/issues/39500 is fixed. $block_pattern_categories = array( 'featured' => array( 'label' => __( 'Featured', 'remote' ) ), 'columns' => array( 'label' => __( 'Columns', 'remote' ) ),