Skip to content

Commit

Permalink
Revert changes to blocks' dynamic PHP code
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Oct 12, 2023
1 parent 8522bc8 commit 8394dfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/wp-includes/blocks/pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function render_block_core_pattern( $attributes ) {
// Backward compatibility for handling Block Hooks and injecting the theme attribute in the Gutenberg plugin.
// This can be removed when the minimum supported WordPress is >= 6.4.
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && ! function_exists( 'traverse_and_serialize_blocks' ) ) {
$content = _inject_theme_attribute_in_block_template_content( $content );
$blocks = parse_blocks( $content );
$content = gutenberg_serialize_blocks( $blocks );
}
Expand Down
11 changes: 7 additions & 4 deletions src/wp-includes/blocks/template-part.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ function render_block_core_template_part( $attributes ) {
$template_part_id = null;
$content = null;
$area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
$theme = isset( $attributes['theme'] ) ? $attributes['theme'] : get_stylesheet();

if ( isset( $attributes['slug'] ) && get_stylesheet() === $theme ) {
$template_part_id = $theme . '//' . $attributes['slug'];
if (
isset( $attributes['slug'] ) &&
isset( $attributes['theme'] ) &&
get_stylesheet() === $attributes['theme']
) {
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
$template_part_query = new WP_Query(
array(
'post_type' => 'wp_template_part',
Expand All @@ -31,7 +34,7 @@ function render_block_core_template_part( $attributes ) {
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => $theme,
'terms' => $attributes['theme'],
),
),
'posts_per_page' => 1,
Expand Down

0 comments on commit 8394dfd

Please sign in to comment.