Code in the footer

Hello team,

I am trying to add Amazon Onelink Javascript code to the footer of my website.

I tried adding the code advised by Christian here https://theme.co/apex/forum/t/how-can-i-add-code-to-footer/15168/2

When I do it, it creates a thin white line and displays "> on the bottom footer of the page. And code is not inserted.

I am placing the Javascript instead of etc. in the code provided by Christian, in the child theme’s theme functions. I am doing it correctly? Plugin doesn’t work either - I only put the code in the footer section, nothing happens

Thanks!

Hey Sevda,

Thanks for writing in!

Please make sure that when you insert the custom code in your child theme’s functions.php file, you insert something like this:

add_action( 'wp_footer', 'add_footer_code', 9999 );

function add_footer_code()  { ?>
  <script async src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=f83b2fff-7bf3-4d6a-97df-71c4a6ef54be"></script>
<?php }

You will need to copy it correctly. If this does not help, please provide us your WP access or at least post your custom code when you reply.

Thank for your reply.

I copy the code exactly and put my code between the commas " after scr=. I also remove //, do I need to leave it in?

It is still the same issue. Do I need to only put my code between the commas? Do I need to point it anywhere else?

Thanks

Hello Sevda,

You must use this code:

add_action( 'wp_footer', 'add_footer_code', 9999 );

function add_footer_code()  { ?>
  <div id="amzn-assoc-ad-6d48eeb7-1247-4ed8-8193-b62ee4628de9"></div>
  <script async src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=6d48eeb7-1247-4ed8-8193-b62ee4628de9"></script>
<?php }

If that does not help, would you mind providing us access to your site so that we can take a closer look? Please create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to create a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

Regards.

Thank you @RueNel

I don’t think it’s working still. How can I check it has been integrated? I will put a secure note so you can have a look for me, please.

Hello Sevda,

I have checked your site and I am sure that the code is already loaded in the page. You can view it by using the url in the secure note below. I am just not sure what it it’s display or where does it will display. You might want to contact the source of the script and ask them for further assistance.

Regards.

@RueNel

Yes, it is on there! It would not be visible at all, just a tracking code.

I am so grateful for your help, all the best!! You are amazing.

You’re most welcome!
We’re glad we were able to help you out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.