@famethemes
Okey, I tried but it didn’t work as intended. It may be that I’m doing something wrong so I post my edits here.
In the function.php for the child theme I write the code down under in the end of the file. I also copy the plugin.js file and directory path over to the child theme, as well as ereasing the lightgallery code part from the file so it can’t be read from the new file. Is it correct? Do I need to type in the priority order for the action to appear maybe? If so, which priority should I have?
Thanks a lot for your support!
/**
* Custom code
* Turn off default lightgallery.
* /assets/js/plugins.js
*/
function remove_scripts() {
//----- JS
wp_dequeue_script( 'plugins' );
wp_deregister_script('plugins');
}
add_action('wp_print_scripts', 'remove_scripts');
/**
* Custom code
* Enqueue a script with jQuery as a dependency.
* Get plugin.js from childtheme instead.
*/
function wpdocs_scripts_method() {
wp_enqueue_script( 'plugins', get_stylesheet_directory_uri() . '/assets/js/plugins.js', array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_scripts_method');