[child theme] url() to images in parent css no longer works
-
Hi everyone,
I’m adding a child theme for a site i’m working on, the child works for most parts but when it comes to some styles that references urls in parent theme, they no longer works.
First of all, here is the functions.php im using in child:<?php function my_theme_enqueue_styles() { $parent_style = 'parent-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ) ); } add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); ?>
the child style.css is still empty.
The problem rises on parent styles like this:
.home-background {background-image: url(img/homebackground.jpg);}
which now returns a 404 error because it looks for a /img folder in my child theme that doesn’t exist. Of course if I copy the parent /img folder to the child all works again. Whats the best way to deal with this ?Thanks!
Massimiliano
- The topic ‘[child theme] url() to images in parent css no longer works’ is closed to new replies.