Archived topic
can gp hooks add a javascript at the post level
3 replies · Started by Ashley Gainer on June 7, 2017
Non-coder here! I need to add a script tag at the post level. Is this something I can do with hooks, and if so... would I put it in After Content? If I put it there, will the script tag also go onto pages? (I want it to go only on posts.)
Thanks for any help!
Hi there,
Which hook you should use depends on where you want the content to show up:
https://docs.generatepress.com/article/hooks-overview/
http://demo.generatepress.com/hook-locations/
Then you would wrap it with conditional tag so it's single post only:
<?php if ( is_single() ) { ?>
script here
<?php } ?>
thank you!!
You're welcome :)