wp_enqueue_scripts not working with js
-
Pulling my hair out over this one!
I have a plugin with a number of js functions. If the js is put directly in the php file it works fine.
However, I took the js functions out and put them in a new file (in the same directory).
In the php file I have this:
function casting_call_register_files() { // css file wp_register_style( 'casting_call-style', plugins_url( 'casting_call.css', __FILE__ ) ); wp_enqueue_style( 'casting_call-style' ); // js file wp_register_script( 'casting_call-script', plugins_url('casting_call.js', __FILE__ ) ); wp_enqueue_script( 'casting_call-script' ); } add_action( 'wp_enqueue_scripts', 'casting_call_register_files' );The CSS file loads fine, but the JS file is not found and (obviously) doesn’t work.
I’ve tried all sorts of things but just cannot get the js to work from another file.
Any help appreciated!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘wp_enqueue_scripts not working with js’ is closed to new replies.