Skip to content

Commit

Permalink
[Site Editor]: Update single default template copy (#41302)
Browse files Browse the repository at this point in the history
* [Site Editor]: Update single default template copy

* Update lib/compat/wordpress-6.1/block-template-utils.php

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
  • Loading branch information
ntsekouras and Mamaduka authored May 25, 2022
1 parent bfa2ec6 commit 9c1c67b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/compat/wordpress-6.1/block-template-utils.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Temporary compatibility shims for features present in Gutenberg.
* This file should be removed when WordPress 6.1.0 becomes the lowest
* supported version by this plugin.
*
* @package gutenberg
*/

/**
* Updates the list of default template types, containing their
* localized titles and descriptions.
*
* We will only need to update `get_default_block_template_types` function.
*
* @param array $default_template_types The default template types.
*
* @return array The default template types.
*/
function gutenberg_get_default_block_template_types( $default_template_types ) {
if ( isset( $default_template_types['single'] ) ) {
$default_template_types['single'] = array(
'title' => _x( 'Single', 'Template name', 'gutenberg' ),
'description' => __( 'The default template for displaying any single post or attachment.', 'gutenberg' ),
);
}
return $default_template_types;
}
add_filter( 'default_template_types', 'gutenberg_get_default_block_template_types', 10 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.1/get-global-styles-and-settings.php';
require __DIR__ . '/compat/wordpress-6.1/script-loader.php';
require __DIR__ . '/compat/wordpress-6.1/class-wp-theme-json-6-1.php';
require __DIR__ . '/compat/wordpress-6.1/block-template-utils.php';

// Experimental features.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API.
Expand Down

0 comments on commit 9c1c67b

Please sign in to comment.