Archived topic
where to add javascript
3 replies · Started by Jim on September 14, 2021
I need to install a "Book Online" Button. Instructions from vendor (zocdoc): I would like to put it in the navigation bar primary menu, if possible. Or a "call to action" button would be ok, too. Where do I put the following javascript code?
JavaScript code
<script>(function (d) {var script = d.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'https://link.edgepilot.com/s/5cc8a598/FtBd_AarR0W5NJmBTGptdg?u=https://offsiteschedule.zocdoc.com/plugin/embed%27%3Bvar s = d.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);})(document);</script>
Hi there,
Did Zocdoc provide any specifics on where the code should be added?
If not then try adding in the wp_footer hook with a hook element first:
https://docs.generatepress.com/article/hooks-element-overview/
https://docs.generatepress.com/article/wp_footer/
It worked...thank you, thank you, thank you... I followed your documentation links and learned how to use elements. I then created a "menu item" hook and embedded the code. You guys rock!! I am so glad I found GeneratePress as my goto website development platform.
Glad to hear :)
