GetSimple Support Forum
QUESTION How to Include .js File on All Pages? - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11)
+--- Thread: QUESTION How to Include .js File on All Pages? (/showthread.php?tid=16836)



How to Include .js File on All Pages? - johnywhy - 2022-11-18

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


RE: How to Include .js File on All Pages? - Felix - 2022-11-20

No need for add-on
Just use php include in the <head> section
or just before the </body> tag


RE: How to Include .js File on All Pages? - johnywhy - 2022-11-21

(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?


RE: How to Include .js File on All Pages? - islander - 2022-11-21

(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.