Skip to content

Commit

Permalink
Make use of new methods in page-templates.php
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Feb 3, 2021
1 parent 92bbe8a commit 11f4d79
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/full-site-editing/page-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ||
Expand Down

0 comments on commit 11f4d79

Please sign in to comment.