adding code to theme

HI
I am using the WPMU modified "Spirit theme".
I need to add Paypal marketing solutions script to the website.
<!-- PayPal BEGIN -->
<script>
;(function(a,t,o,m,s){a[m]=a[m]||[];a[m].push({t:new Date().getTime(),event:'snippetRun'});var f=t.getElementsByTagName(o)[0],e=t.createElement(o),d=m!=='paypalDDL'?'&m='+m:'';e.async=!0;e.src='https://www.paypal.com/tagmanager/pptm.js?id='+s+d;f.parentNode.insertBefore(e,f);})(window,document,'script','paypalDDL','22f8b5cf-169d-45e1-ac74-34a3a20dd943':wink:;
</script>
<!-- PayPal END -->
The instructions are:
Scroll down to the bottom of the footer.php file. Paste the PayPal script before the ending body tag. NOTE: Script placement may vary depending on the WooCommerce theme used.
Follow these steps for every page in your website where you want to collect information on your visitors. Note that some sites use a method that stores the tag and automatically copies it to all of your pages, so you won't need to add it manually to the HTML file for each page.

How do I do this please.

  • Adam Czajczyk
    • Support Gorilla

    Hi simon cuss

    I hope you're well today and thank you for your question!

    In this case I'd suggest using MU plugin for this, due to the way Upfront themes worked. You could do it like this:

    - create an empty file with a .php extension (e.g. "add-pp-marketing-code.php")
    - copy and paste this code into it (using some "clean text" editor such as Notepad++, Sublime or any PHP IDE):

    <?php 
    
    function add_pp_marketing_script() {
    	?>
    	<!-- PayPal BEGIN -->
    <script>
    ;(function(a,t,o,m,s){a[m]=a[m]||[];a[m].push({t:new Date().getTime(),event:'snippetRun'});var f=t.getElementsByTagName(o)[0],e=t.createElement(o),d=m!=='paypalDDL'?'&m='+m:'';e.async=!0;e.src='https://www.paypal.com/tagmanager/pptm.js?id='+s+d;f.parentNode.insertBefore(e,f);})(window,document,'script','paypalDDL','22f8b5cf-169d-45e1-ac74-34a3a20dd943':wink:;
    </script>
    <!-- PayPal END -->
    	<?
    }
    add_action( 'wp_footer', 'add_pp_marketing_script' );

    - save the file and access the site install using FTP or cPanel's "File Manager"
    - upload the file to the "/wp-content/mu-plugins" folder; if there's no "mu-plugins" folder right inside "wp-content" folder, just create an empty one first.

    Give it a try, please, and let me know if it worked for you.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.