Adding custom javascript
-
Hi,
I am trying to add my custom javascript with this code in my functions.php from my child-theme.
function my_custom_scripts() { wp_register_script( 'custom.js', get_stylesheet_directory_uri() . '../js/custom.js', array( 'jquery' ) ); wp_enqueue_script('custom.js'); } add_action('wp_enqueue_scripts', 'my_custom_scripts');It is loading my script, because I can see my console.log messages in the console, but it is not loading the jquery dependency. Why is this happening?
I hope you guys can help me out with this weird problem.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Adding custom javascript’ is closed to new replies.