[Resolved] can gp hooks add a javascript at the post level

Home Forums Support [Resolved] can gp hooks add a javascript at the post level

Home Forums Support can gp hooks add a javascript at the post level

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #329894
    Ashley Gainer

    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!

    #329947
    Leo
    Staff
    Customer Support

    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 } ?>
    #330478
    Ashley Gainer

    thank you!!

    #330512
    Leo
    Staff
    Customer Support

    You’re welcome 🙂

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