I am new to javascript but I’m currently trying to build a responsive image gallery in wordpress with my custom template. I have used this function to load my js file onto my page and it shows in developer tools that it has loads but has an error 404 not found.
My function to load the js script is
function load_js_assets() {
if(is_page(57)){
wp_enqueue_script(‘my-js’, ‘photo.js’, array(‘jquery’), ”, false
);
}
}
add_action(‘wp_enqueue_scripts’, ‘load_js_assets’);
​
That is the correct the file path (i removed it from the js folder just in case i was doing it wrong).
Any help would be greatly appreciated thank you.
[ad_2]
Look at how your theme enqueues its JS files. I can guarantee you it is not using the naked file name like you are.