Hey,
I have signed up for Aweber to add a newsletter form to my website. As part of the installation I need to add the following code to my site:
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//forms.aweber.com/form/83/1926195111.js”;
fjs.parentNode.insertBefore(js, fjs);
}(document, “script”, “aweber-wjs-59oiivt7a”));
I should add the code somewhere between the body-tags. I have done the same thing on other themes, and then it has worked. But in the Vantage theme, nothing happens. I have created a child theme, but I have tried both adding the code to the parent theme and create a new file and added that to the childtheme.
The file I have altered is header.php. This has been the file in other themes. Any suggestions on how to proceed?
Thanks in advance!
// Anders
Hi Anders
Best not to add it to the child theme as those changes will be lost during any theme updates.
Did you add a script wrapper when inserting between the body tags?
That might be the problem.
If you’d like to insert this into the header or footer then the easiest would be to use the following plugin:
https://wordpress.org/plugins/header-and-footer-scripts/
Sorry, there seems like some of the code had been lost in the copying: Here is the entire code i put in:
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//forms.aweber.com/form/83/1926195283.js”;
fjs.parentNode.insertBefore(js, fjs);
}(document, “script”, “aweber-wjs-n3youtenj”));
So the scrip-div is there. I’ve tried both the child theme and the other, but nothing happened.
Damn it, the same thing happened again, but now I’m sure the this site choose not to show it.
Thanks. Perhaps try inserting into the header using:
https://wordpress.org/plugins/header-and-footer-scripts/