| 1 |
<?php |
| 2 |
/** |
| 3 |
* Temporary compatibility shims for features present in Gutenberg. |
| 4 |
* This file should be removed when WordPress 6.1.0 becomes the lowest |
| 5 |
* supported version by this plugin. |
| 6 |
* |
| 7 |
* @package gutenberg |
| 8 |
*/ |
| 9 |
|
| 10 |
/** |
| 11 |
* This function runs in addition to the core `create_initial_theme_features`. |
| 12 |
* The 6.1 release needs to update the core function to include the body of this function. |
| 13 |
* |
| 14 |
* Creates the initial theme features when the 'setup_theme' action is fired. |
| 15 |
* |
| 16 |
* See {@see 'setup_theme'}. |
| 17 |
* |
| 18 |
* @since 5.5.0 |
| 19 |
* @since 6.0.1 The `block-templates` feature was added. |
| 20 |
* @since 6.1.0 The `disable-layout-styles` feature was added. |
| 21 |
*/ |
| 22 |
function gutenberg_create_initial_theme_features() { |
| 23 |
register_theme_feature( |
| 24 |
'disable-layout-styles', |
| 25 |
array( |
| 26 |
'description' => __( 'Whether the theme disables generated layout styles.', 'gutenberg' ), |
| 27 |
'show_in_rest' => true, |
| 28 |
) |
| 29 |
); |
| 30 |
} |
| 31 |
add_action( 'setup_theme', 'gutenberg_create_initial_theme_features', 0 ); |
| 32 |
|
| 33 |
if ( ! function_exists( 'wp_theme_get_element_class_name' ) ) { |
| 34 |
/** |
| 35 |
* Given an element name, returns a class name. |
| 36 |
* Alias from WP_Theme_JSON_Gutenberg::get_element_class_name. |
| 37 |
* |
| 38 |
* @param string $element The name of the element. |
| 39 |
* |
| 40 |
* @return string The name of the class. |
| 41 |
* |
| 42 |
* @since 6.1.0 |
| 43 |
*/ |
| 44 |
function wp_theme_get_element_class_name( $element ) { |
| 45 |
return WP_Theme_JSON_Gutenberg::get_element_class_name( $element ); |
| 46 |
} |
| 47 |
} |
| 48 |
|