[Resolved] Pinterest Javascript

Home Forums Support Pinterest Javascript

  • This topic has 5 replies, 2 voices, and was last updated 4 months ago by Elvin.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1510121
    Janine

    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.

    #1510142
    Elvin
    Staff
    Customer Support

    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.

    A wise man once said:
    "Have you cleared your cache?"

    #1510171
    Janine

    Hi, Elvin.

    This is what they said: To immediately load our JavaScript, include this just above your closing </body> tag.

    Thank you.

    #1510199
    Elvin
    Staff
    Customer Support

    Oh right if that’s the case, wp_footer is exactly what you need.

    https://developer.wordpress.org/reference/functions/wp_footer/

    A wise man once said:
    "Have you cleared your cache?"

    #1510278
    Janine

    Thank you, Elvin. Be safe.

    #1510285
    Elvin
    Staff
    Customer Support

    Thank you, Elvin. Be safe.

    No problem. you too. Cheers. 😀

    A wise man once said:
    "Have you cleared your cache?"

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.