Archived topic
Pinterest Javascript
5 replies · Started by Janine on October 29, 2020
Hi.
I need to add the Pinterest script to my site. (See private information.)
I know how to add elements. But which hook should I choose?
Thank you.
Hi,
It depends on the script. Some scripts work fine even when hooked to wp_head.
But other scripts that manipulate DOM elements may sometimes require have to be added on wp_footer if they don't have .onload or DOMContentLoaded listeners.
That said, if the script you're using is from a source, perhaps the one who wrote it already has an instructions of where to place it. If none, you can try inserting it on wp_head first, and if it fails, try wp_footer.
Hi, Elvin.
This is what they said: To immediately load our JavaScript, include this just above your closing </body> tag.
Thank you.
Oh right if that's the case, wp_footer is exactly what you need.
https://developer.wordpress.org/reference/functions/wp_footer/
Thank you, Elvin. Be safe.
Thank you, Elvin. Be safe.
No problem. you too. Cheers. :D