Thread Starter
Oldjim
(@oldjim)
added notify – as I forgot
In your child theme’s functions.php:
function themeslug_enqueue_style() {
if ( is_child_theme() ) {
// load parent stylesheet first if this is a child theme
wp_enqueue_style( 'parent-stylesheet', trailingslashit( get_template_directory_uri() ) . 'style.css', false );
}
// load active theme stylesheet in both cases
wp_enqueue_style( 'theme-stylesheet', get_stylesheet_uri(), false );
}
add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' );
Since you are using a child theme and presumably using the default style.css of the parent theme, WP will load it first before it loads your custom css from your child theme folder.
And if you want to add JavaScript reference you can do that in the same way:
function themeslug_enqueue_script() {
wp_enqueue_script( 'my-js', 'filename.js', false );
}
add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' );
Please let me know if I could answer you question properly.
Thread Starter
Oldjim
(@oldjim)
For reasons which I don’t understand everything seems to working fine without any changes to the child theme php file so I won’t need to add anything but thank you very much for the information which may be useful in the future
No problem! You are most welcome 🙂