1

I'd like to move all my assets (CSS, JS, Images, Fonts) in an asset folder in my theme.

I did it very well for the fonts and images. For the CSS, I just kept the style.css with the style meta information in it (as advised here).

But I'm using the great underscores.me starter theme for Wordpress and I have in my theme a JS folder containing customizer, navigation.js and skip-link-focus-fix.js

All these scripts are included in my footer via the wp_footer() function. So, if I move these scripts to my /assets/js/ folder, I have three missing files called in the footer.

Is there a way to (1) not load these scripts or (2) change the directory and tell the wp_footer to call /assets/js and not /js/ ?

Thank you for your help.

1

go to your themes functions.php and find line 122. You will find navigation.js function.

get_template_directory_uri() . '/js/navigation.js

and change it to

get_template_directory_uri() . 'assets/js/navigation.js

do it again for skip-link-focus-fix.js code located on line 124.

For customizer go and find customizer.php in 'inc' folder. Go line 53 and change js/customizer.js code to assets/js/customizer.js

Don't forget to move your files :)

| improve this answer | |
  • Indeed. I don't know why I didn't check this file! Thank you for your help @Serkan By the way, are these scripts necessary? – cyclone200 Dec 25 '17 at 14:54
  • You are welcome. Customizer anda navigation possibly needed. About other one i am not sure. – Serkan Algur Dec 25 '17 at 15:04
0

These scripts are enqueued in functions.php using function wp_enqueue_script(). So open your functions.php file, search for these scripts then remove the call so as not to load them, or change the path to your new directory.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.