Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the gutenberg_is_fse_theme function to use wp_is_block_theme #37161

Merged
merged 2 commits into from
Dec 7, 2021
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
4 changes: 2 additions & 2 deletions lib/compat/wordpress-5.9/template-parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/

// Only run any of the code in this file if the version is less than 5.9.
// wp_is_block_template_theme was introduced in 5.9.
if ( ! function_exists( 'wp_is_block_template_theme' ) ) {
// wp_is_block_theme was introduced in 5.9.
if ( ! function_exists( 'wp_is_block_theme' ) ) {
/**
* Registers block editor 'wp_template_part' post type.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/compat/wordpress-5.9/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/

// Only run any of the code in this file if the version is less than 5.9.
// wp_is_block_template_theme was introduced in 5.9.
if ( ! function_exists( 'wp_is_block_template_theme' ) ) {
// wp_is_block_theme was introduced in 5.9.
if ( ! function_exists( 'wp_is_block_theme' ) ) {
/**
* Registers block editor 'wp_template' post type.
*/
Expand Down
8 changes: 8 additions & 0 deletions lib/full-site-editing/full-site-editing.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
/**
* Returns whether the current theme is an FSE theme or not.
*
* Note: once 5.9 is the minimum supported WordPress version for the Gutenberg
* plugin, we must deprecate this function and
* use wp_is_block_theme instead.
*
* @return boolean Whether the current theme is an FSE theme or not.
*/
function gutenberg_is_fse_theme() {
if ( function_exists( 'wp_is_block_theme' ) ) {
return wp_is_block_theme();
}

return is_readable( get_theme_file_path( '/block-templates/index.html' ) ) ||
is_readable( get_theme_file_path( '/templates/index.html' ) );
}
Expand Down