Hi Mohammad,
In my child theme’s functions.php I am using this code:
if ( !is_admin() ) { // instruction to only load if it is not the admin area
// register your script location, dependencies and version
wp_register_script(
'custom-abend-javascript',
get_stylesheet_directory_uri() . '/custom-abend-javascript.js',
false,
'1.0',
true );
// enqueue the script
wp_enqueue_script('custom-abend-javascript');
}
I also tried this code as well:
add_action( 'wp_enqueue_scripts', 'child_add_scripts' );
/**
* Register and enqueue a script that does not depend on a JavaScript library.
*/
function child_add_scripts() {
wp_register_script(
'custom-abend-javascript',
get_stylesheet_directory_uri() . '/custom-abend-javascript.js',
false,
'1.0',
true
);
wp_enqueue_script( 'custom-abend-javascript' );
}
Thanks!