0

Is it possible to have css and js scripts outside of template directory? If it is possible, how can I achieve it?

Basically, instead of having:

http://example.com/wp-content/themes/mytheme/assets/mystyle.css

I want to have:

http://example.com/assets/mystyle.css
1

Yes, you can enqueue JS and CSS from anywhere - even other sites. However, your theme will have to have a "style.css" with at minimum the required comments for WP to recognize it as a theme that can be activated.

|improve this answer|||||
  • I didn't quite get it. I have WP installed inside the root folder (public_html). The structure of WP files is normal wp-admin, wp-content,... I don't want to have scripts inside root/wp-content/themes/mytheme, but I want them to be outside theme folder. How can I achieve that? – dodo254 Aug 10 '19 at 14:12
  • Place them wherever you want, but enqueue them from root/wp-content/themes/mytheme/functions.php - just give the full server path to wherever you've put them. – WebElaine Aug 12 '19 at 13:22

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.