This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

How to put the code in to Vantage theme

10 years ago · Last reply by Andrew Misplon 10 years ago

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

URL: http://casinofakturan.se

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

4
  1. Andrew Misplon Staff 10 years, 10 months ago

    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?

    <script>
    (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"));
    </script>

    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/

  2. Anders Bergman 10 years, 10 months ago

    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.

  3. Anders Bergman 10 years, 10 months ago

    Damn it, the same thing happened again, but now I’m sure the this site choose not to show it.

    <div class="AW-Form-1926195283"></div>
    <script type="text/javascript">(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"));
    </script>
  4. Andrew Misplon Staff 10 years, 10 months ago

    Thanks. Perhaps try inserting into the header using:

    https://wordpress.org/plugins/header-and-footer-scripts/

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread