To enqueue I have used get_theme_file_uri('/style.css')
. Now I have created a child theme using a generator and it created a code like the following; but it throws a php error with parent-style.
- Is the code below really needed if I am using
get_theme_file_uri()
in my parent theme as it will automatically search for file in child theme? - I have some
css
code in parent theme (style.css
). So if I use child theme (which is empty). So will the parent theme style get applied?
function theme_enqueue_styles() {
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', 'theme_enqueue_styles');
Thanks