Skip to content

Commit

Permalink
fix #714
Browse files Browse the repository at this point in the history
  • Loading branch information
shimotmk committed Sep 10, 2024
1 parent 2ba5e3a commit 30c0a45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/create-theme/theme-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function get_media_absolute_urls_from_template( $template ) {
public static function make_relative_media_url( $absolute_url ) {
if ( ! empty( $absolute_url ) && CBT_Theme_Utils::is_absolute_url( $absolute_url ) ) {
$folder_path = self::get_media_folder_path_from_url( $absolute_url );
return '<?php echo esc_url( get_stylesheet_directory_uri() ); ?>' . $folder_path . basename( $absolute_url );
return '<?php echo esc_url( get_template_directory_uri() ); ?>' . $folder_path . basename( $absolute_url );
}
return $absolute_url;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test-theme-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function test_template_with_media_correctly_prepared() {
$this->assertContains( 'http://example.com/image.jpg', $new_template->media );

// The pattern is correctly encoded
$this->assertStringContainsString( '<img src="<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/assets/images/image.jpg"', $new_template->pattern );
$this->assertStringContainsString( '<img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/image.jpg"', $new_template->pattern );

}

Expand All @@ -77,7 +77,7 @@ public function test_make_group_block_local() {
$this->assertContains( 'http://example.com/image.jpg', $new_template->media );

// The pattern is correctly encoded
$this->assertStringContainsString( '{"backgroundImage":{"url":"<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/assets/images/image.jpg"', $new_template->pattern );
$this->assertStringContainsString( '{"backgroundImage":{"url":"<?php echo echo esc_url( get_template_directory_uri() ); ?>/assets/images/image.jpg"', $new_template->pattern );

}
}

0 comments on commit 30c0a45

Please sign in to comment.