Adding OneLink

Hi guys,

trying to add the Amazon Onelink code to my site, here are the instructions:

“Copy the JavaScript code below and integrate into the footer/before the end tag of the body of your website”

I followed what it says here: https://theme.co/apex/forum/t/how-can-i-add-code-to-footer/15168 but it doesn’t seem to work. Will add code I added in a private note.

Something about being rolled back because there was an unexpected ‘}’.

Thanks.

Hi There,

Thank you for writing in, the code provided by Christian on the thread you linked works, I’d just tested it.

That is because you closed the PHP tag and did not open again, on your functions.php file (codes you shown above) notice the line: <?php } ?> at the bottom.

Please remove that closing PHP tag ?> so your PHP tag will be kept open.

So you can then add the code provided by Christian.

You can do a simple check if the code works, to do this visit your page (any page) then do a view-source (Ctrl+U on Windows and Option+Command+U on MAC), then scroll at the bottom look for the </body> tag, just above that see if your Amazon code you added is there.

Hope it helps,
Cheers!

Thanks very much,

And do I have to close the php after I add any new code, or just leave it open @friech?

Hi there,

You do not have to close the last PHP block so if the last line of your code is:

<?php }

Simply add the other PHP code below it if you want to add more lines of code.

Hope this helps.

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