It is not best practice to use @import for child themes. Instead, use this in the functions.php file:
* Enqueue the parent theme stylesheet.
*/
add_action( ‘wp_enqueue_scripts’, ‘vantage_parent_style’ );
function vantage_parent_style() {
wp_enqueue_style( ‘parent-theme’, get_template_directory_uri() . ‘/style.css’ );
}
/**
* Enqueue the child theme stylesheet.
*/
add_action( ‘wp_enqueue_scripts’, ‘multipurpose_child_style’, 20 );
function multipurpose_child_style() {
wp_enqueue_style( ‘child-theme’, get_stylesheet_uri() );
}
In order for WordPress to be able to inherit styles and functions from another “parent” theme, it needs to be able to read files from both themes but treats the child theme as the “active” theme.
WordPress first reads the active theme’s stylesheet (style.css
) to get the theme’s “header” properties. It then checks if the theme has a functions file (functions.php
) and executes it if it exists.
Using wp_enqueue_scripts to load stylesheets and scripts is recommended because it allows WordPress to optimize the load order and prevent conflicts.