Javascript works in page-xxx.php but not when i put it in script.js

Hi I have some slick slider javascript in my PHP for when I was testing it but now I want to move it into a separate scripts.js file but when I do that it does not work I believe I am using wp_enqueue_scripts for jquery and slick.js but still nothing I have even echoed the function and can see it on the front end and I am making sure the wp_head(); and wp_footer(); is called in header.php and footer.php

Does anyone know a fix for this?

my functions PHP looks like this:

function load_external_scripts() { 
	//jquery
    wp_register_script('jquery', get_template_directory_uri() . '/assets/js/scripts.js',array('jquery','slick.js','aos.js'),'', false );
	wp_enqueue_script('jquery');
	wp_enqueue_script('slick.js', get_template_directory_uri() . '/assets/slick/slick.min.js',array('jquery'),'', false );
	wp_enqueue_script('aos.js', get_template_directory_uri() . '/node_modules/aos-master/dist/aos.js',array('jquery'),'', false );
	
    //css
    wp_register_style('css', get_template_directory_uri() . '/css/print.css',array(),'print', false );
	wp_enqueue_style('css'); 
	
	echo "Load Script Test";
}  
add_action('wp_enqueue_scripts', 'load_external_scripts');

I feel like stuffing additional scripts inside the jquery file is not the right pattern to get this to work. Have you tried separating the two?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.