From 11f4d79278428b48226acd504eeadc5c1aa36d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Wed, 3 Feb 2021 18:44:21 +0100 Subject: [PATCH] Make use of new methods in page-templates.php --- lib/full-site-editing/page-templates.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/full-site-editing/page-templates.php b/lib/full-site-editing/page-templates.php index 89ce31dba143f..46ce5f37c6491 100644 --- a/lib/full-site-editing/page-templates.php +++ b/lib/full-site-editing/page-templates.php @@ -17,15 +17,9 @@ function gutenberg_load_block_page_templates( $templates, $theme, $post ) { if ( ! gutenberg_is_fse_theme() ) { return $templates; } - $config_file = locate_template( 'experimental-theme.json' ); - if ( ! file_exists( $config_file ) ) { - return $templates; - } - $data = json_decode( - file_get_contents( $config_file ), - true - ); - $page_templates = array(); + + $resolver = WP_Theme_JSON_Resolver(); + $page_templates = $resolver->get_theme_data()->get_page_templates(); if ( isset( $data['pageTemplates'] ) ) { foreach ( $data['pageTemplates'] as $key => $page_template ) { if ( ( ! isset( $page_template['postTypes'] ) && 'page' === $post->post_type ) ||