How to override parent-scripts with child-theme scripts
-
I have created a child-theme and i copied the js folder. I am trying to get the child-theme to ovveride the js files. Especially the custom.js file.
This is what my code in functions.php looks like:
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_scripts_fix’, 100 );
function theme_enqueue_scripts_fix()
{
wp_dequeue_script( ‘parent_theme_script_handle’ );
wp_enqueue_script( ‘child_theme_script_handle’, get_stylesheet_directory_uri() . ‘/hjortron/js/custom.js’, array( ‘jquery’ ) );
}What would be the best way to accomplish this?
- The topic ‘How to override parent-scripts with child-theme scripts’ is closed to new replies.