Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Apply Mike's fix for child theme images (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
kienstra committed Mar 1, 2023
1 parent ea4ebec commit 84c2415
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wp-modules/pattern-data-handlers/pattern-data-handlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function tree_shake_theme_images() {
$backedup_images_dir = $wp_filesystem->wp_content_dir() . 'temp-images/';
$images_dir = $theme_dir . '/patterns/images/';

$wp_theme_url = get_template_directory_uri();
$wp_theme_url = get_stylesheet_directory_uri();
$images_url = $wp_theme_url . '/patterns/images/';

if ( ! $wp_filesystem->exists( $backedup_images_dir ) ) {
Expand Down Expand Up @@ -440,7 +440,7 @@ function move_block_images_to_theme( $pattern_html ) {
$assets_dir = $wp_theme_dir . '/assets/';
$images_dir = $wp_theme_dir . '/patterns/images/';

$wp_theme_url = get_template_directory_uri();
$wp_theme_url = get_stylesheet_directory_uri();
$images_url = $wp_theme_url . '/patterns/images/';

if ( ! $wp_filesystem->exists( $assets_dir ) ) {
Expand Down Expand Up @@ -492,7 +492,7 @@ function move_block_images_to_theme( $pattern_html ) {
);

// Replace the URL with the one we just added to the theme.
$pattern_html = str_replace( $url_found, "<?php echo esc_url( get_template_directory_uri() ); ?>/patterns/images/$filename", $pattern_html );
$pattern_html = str_replace( $url_found, "<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/patterns/images/$filename", $pattern_html );
}

return $pattern_html;
Expand Down

0 comments on commit 84c2415

Please sign in to comment.