Site logo

[Support request] How to add javascript snippets to individual posts?

Home Forums Support [Support request] How to add javascript snippets to individual posts?

Home Forums Support How to add javascript snippets to individual posts?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2525645
    wordpressuser13

    I am creating a website where for each post, I have to add a Javascript snippet inside the post, something like this:

    <script src=”CODE HERE

    I tried adding it via the HTML block, and when I preview it in the backend the Javascript runs normally. However, when I view the post in the frontend, it doesnt’show anything.

    I’m wondering if there’s a way to add the Javascript code using hooks or generateblocks? Note that each post needs its own Javascript code. Maybe I can create a custom hook for each post? Is this possible?

    Thank you so much for the help, really loving this theme and the support!

    #2525787
    David
    Staff
    Customer Support

    Hi there,

    the HTML block should work, if not try adding a Classic Editor block, and set that to code view and add your script in there.

    Otherwise you can use Hooks, but that would entail a new hook for each post ( set in the Display Rule > Location )… and that could result in a lot of admin work.

    Let me know about the classic editor block.

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