-
Notifications
You must be signed in to change notification settings - Fork 383
Closed
Labels
ChangeloggedWhether the issue/PR has been added to release notes.Whether the issue/PR has been added to release notes.
Milestone
Description
- Update
theme_has_theme_jsonmethod to reflect what was actually committed. - Uncomment the call to
wp_theme_has_theme_json()if defined.
amp-wp/src/ReaderThemeSupportFeatures.php
Lines 581 to 626 in d7a6af8
| private function theme_has_theme_json() { | |
| // @TODO: Uncomment this once `wp_theme_has_theme_json()` caching is fixed. | |
| // if ( function_exists( 'wp_theme_has_theme_json' ) ) { | |
| // return wp_theme_has_theme_json(); | |
| // } | |
| static $theme_has_support = null; | |
| static $prev_stylesheet_directory = null; | |
| static $prev_template_directory = null; | |
| $stylesheet_directory = get_stylesheet_directory(); | |
| $template_directory = get_template_directory(); | |
| // Make sure that the cached $theme_has_support value is reset when the theme changes. | |
| if ( null !== $theme_has_support && ( | |
| $stylesheet_directory !== $prev_stylesheet_directory || | |
| $template_directory !== $prev_template_directory | |
| ) ) { | |
| $theme_has_support = null; | |
| } | |
| $prev_stylesheet_directory = $stylesheet_directory; | |
| $prev_template_directory = $template_directory; | |
| if ( | |
| null !== $theme_has_support && | |
| // Ignore static cache when the development mode is set to 'theme', to avoid interfering with | |
| // the theme developer's workflow. | |
| ( function_exists( 'wp_get_development_mode' ) && wp_get_development_mode() !== 'theme' ) | |
| ) { | |
| return $theme_has_support; | |
| } | |
| // This is the same as get_theme_file_path(), which isn't available in load-styles.php context. | |
| if ( $stylesheet_directory !== $template_directory && file_exists( $stylesheet_directory . '/theme.json' ) ) { | |
| $path = $stylesheet_directory . '/theme.json'; | |
| } else { | |
| $path = $template_directory . '/theme.json'; | |
| } | |
| /** This filter is documented in wp-includes/link-template.php */ | |
| $path = apply_filters( 'theme_file_path', $path, 'theme.json' ); | |
| $theme_has_support = file_exists( $path ); | |
| return $theme_has_support; | |
| } |
Metadata
Metadata
Assignees
Labels
ChangeloggedWhether the issue/PR has been added to release notes.Whether the issue/PR has been added to release notes.