Skip to content

Commit

Permalink
Patterns: Register new media related categories (#55236)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored Oct 17, 2023
1 parent 58064cc commit 343b903
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/compat/wordpress-6.5/block-patterns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Extends Core's wp-includes/block-patterns.php to add new media related
* pattern categories for WP 6.5.
*
* @package gutenberg
*/

/**
* Adds new pattern categories for better organization of media related patterns.
*
* Note: This should be removed when the minimum required WP version is >= 6.5.
*
* @return void
*/
function gutenberg_register_media_pattern_categories() {
// Register new categories.
register_block_pattern_category(
'videos',
array(
'label' => _x( 'Videos', 'Block pattern category' ),
'description' => __( 'Different layouts containing videos.' ),
)
);
register_block_pattern_category(
'audio',
array(
'label' => _x( 'Audio', 'Block pattern category' ),
'description' => __( 'Different layouts containing audio.' ),
)
);
}
add_action( 'init', 'gutenberg_register_media_pattern_categories' );
3 changes: 3 additions & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.4/script-loader.php';
require __DIR__ . '/compat/wordpress-6.4/kses.php';

// WordPress 6.5 compat.
require __DIR__ . '/compat/wordpress-6.5/block-patterns.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
require __DIR__ . '/experimental/blocks.php';
Expand Down

0 comments on commit 343b903

Please sign in to comment.