Custom js inclusion

Hi, 

Is there a way to include custom js files similar to the custom.css into the theme? I'd like to include a few new functions in a separate file and then use custom js box in for initialization code only.

Comments

  • Hi,

    for that we created Theme options > Layout > Custom CSS & JS > Custom JS section where you can keep own js functions.
  • Yes, well I know that one. What I asked was if there was a way of including a js FILE instead of pasting it into the box. If I have 400 lines of js code that little box is not a great place to put it in. That box is good for init code as it ends up at the bottom of the document.

    You can use custom css by uploading a custom.css file - why is there no similar feature for js?
  • Everything is possible but you must know coding. But if you ask about file including, i guess that you are not familiar with coding and in this case you should contact with your website developer.
  • I know how to include a file. No need to be rude. I was asking if there is a way to include it from within the theme environment so as not to have to edit the template files and make updating there theme a hassle in the future.

    There is no hook for the document head so I am asking ig you've made it possible somewhere else.

    I'd take a simple "no" over the patronizing attitude thanks.
  • Who is rude? Because probably you are not talking about us :) However when someone is asking if this is possible, for us it means that he don't know how to do it. But if you are sure that you know how to do it then do it in functions/theme-head.php file. This file include all css and js files. But please remember that after modifications you won't be able to do theme updates.
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.