Posts: 32
Threads: 13
Joined: Aug 2010
How to include an external script file on
all pages on the site, that won't get broken when i update get-simple or update the theme?
Where to put this?
Code:
<script src="myscripts.js"></script>
Is there an add-on that would help
thx
Posts: 515
Threads: 21
Joined: Feb 2019
No need for add-on
Just use php include in the <head> section
or just before the </body> tag
Posts: 32
Threads: 13
Joined: Aug 2010
(2022-11-20, 20:19:23)Felix Wrote: No need for add-on
Just use php include in the <head> section
or just before the </body> tag
In which file?
Posts: 324
Threads: 5
Joined: May 2012
(2022-11-21, 01:20:19)johnywhy Wrote: (2022-11-20, 20:19:23)Felix Wrote: No need for add-on
Just use php include in the <head> section
or just before the </body> tag
In which file?
Browse to your theme that you would like to update.
For example "\theme\Innovation\"
In this example, we will add it to the file "footer.inc.php"
Change lines 24-27 from:
Code:
</footer>
</body>
</html>
to:
Code:
</footer>
<script src="<?php get_theme_url(); ?>/assets/js/myscripts.js"></script>
</body>
</html>
And make sure you have saved your new "myscripts.js" file info folder "\theme\Innovation\assets\js"
You can adapt this method to whichever theme you are using.