Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How do I add custom JS code to header/footer?
unixhero
✭
Hi
I am installing/enabling an analytics package by Heapanalytics.com . Here are the installation instructions:
"Just paste the following code snippet before your website's closing tag. We'll take care of the rest."
I tried googling around, and I searched the forums... but the answers didn´t make any sense to me.
I want to add a javascript code before the @<@/@head@>@ tag.
I am using the default Vanillaforums theme.
Which file should I edit?
0
Comments
You can add the js in your default.master.php or you can make a plugin to add it.
I sugest you download a custom theme and learn how it is put together because to be able to do what you want you need to have a custom theme or create one.
The default theme is the master theme and should not be edited.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
You can also create a ThemeHooks file for your theme or use the Pockets plugin to insert HTML code to various areas on your website.
Add Pages to Vanilla with the Basic Pages app
+1 for the Pockets plugin, by far the easiest way to add custom JS.
My shop | About Me
Thanks for your suggestions. I am trying to go with the Pockets route, but I am running into problems. The Pockets plugin gives me a 404 when I add a script as a pocket, although html and pure text works fine... I have posted a question to the Pockets-plugin author/community.
Now I have added the script to the default.master.php file in in the dashboard/views folder.
Hi again
pasting a javascript snippet above the header in default.master.tpl does not work and crashes the forum
pasting a javascript snippet in Pockets does not work (I was on 2.0 then, and 2.1, new webhost)
Maybe someone could suggest another way I can add an analytics javascript snippet in a header?