Skip to content
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
10 changes: 1 addition & 9 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,16 +493,8 @@ public static function theme_has_support() {
* @return string The whole file path or empty if the file doesn't exist.
*/
private static function get_file_path_from_theme( $file_name ) {
// This used to be a locate_template call.
// However, that method proved problematic
// due to its use of constants (STYLESHEETPATH)
// that threw errors in some scenarios.
//
// When the theme.json merge algorithm properly supports
// child themes, this should also fallback
// to the template path, as locate_template did.
$located = '';
$candidate = get_stylesheet_directory() . '/' . $file_name;
$candidate = get_theme_file_path( $file_name );
if ( is_readable( $candidate ) ) {
$located = $candidate;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/full-site-editing/full-site-editing.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @return boolean Whether the current theme is an FSE theme or not.
*/
function gutenberg_is_fse_theme() {
return is_readable( get_stylesheet_directory() . '/block-templates/index.html' );
return is_readable( get_theme_file_path( '/block-templates/index.html' ) );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/template-part/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function render_block_core_template_part( $attributes ) {
} else {
// Else, if the template part was provided by the active theme,
// render the corresponding file content.
$template_part_file_path = get_stylesheet_directory() . '/block-template-parts/' . $attributes['slug'] . '.html';
$template_part_file_path = get_theme_file_path( '/block-template-parts/' . $attributes['slug'] . '.html' );
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
$content = _gutenberg_inject_theme_attribute_in_content( file_get_contents( $template_part_file_path ) );
}
Expand Down