Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1320178
    bperry420
    Participant

    Hello,

    I need to add the following javascript code to my site.
    I am placing it in the Custom Global Javascript section of Customizer.

    Can I add it exactly like this or do I need to remove anything from it?
    (This is code for a marketing tool called Net-Results)

    Here is the code:

    <script id=”__maSrc” type=”text/javascript” data-pid=”15845″>
    (function () {
    var d=document,t=’script’,c=d.createElement(t),s=(d.URL.indexOf(‘https:’)==0?’s’:”),p;
    c.type = ‘text/java’+t;
    c.src = ‘http’+s+’://’+s+’c.cdnma.com/apps/capture.js’;
    p=d.getElementsByTagName(t)[0];p.parentNode.insertBefore(c,p);
    }());
    </script>

    website URL: rdvsystems.com
    wordpress version: 4.7
    X Theme version: 4.6.4

    #1320209
    Thai
    Moderator

    Hi There,

    Please add the following code under functions.php file locates in your child theme:

    add_action( 'wp_head', 'add_custom_script' );
    function add_custom_script(){
    	?>
    		<script id="__maSrc" type="text/javascript" data-pid="15845">
    		(function () {
    		var d=document,t='script',c=d.createElement(t),s=( d.URL.indexOf('https:')==0 ? 's' : '' ),p;
    		c.type = 'text/java'+t;
    		c.src = 'http'+s+'://'+s+'c.cdnma.com/apps/capture.js';
    		p=d.getElementsByTagName(t)[0];p.parentNode.insertBefore(c,p);
    		}());
    		</script>
    	<?php
    }

    Regards!

    #1320305
    bperry420
    Participant

    Then what is the “global javascript” section for in the appearance / customize / custom area?

    #1320752
    Christopher
    Moderator

    Hi there,

    That’s for adding JS code but what you have is a function and it should be added under child theme’s functions.php file.

    Thanks.

  • <script> jQuery(function($){ $("#no-reply-1320178 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>