Archived topic
Body Script field
5 replies · Started by Aaron on February 12, 2021
I'm moving from a Genesis theme to GP. Genesis has a "Body Script" field that I have used a fair amount for both pages and posts. Is there a way to replicate this in GP without getting into the code?
Hi there,
what does the body script field do exactly ?
Is it for adding code into the Header / Footer ?
It places code either after the opening body tag or before the closing body tag based on what selection you make. It also has a header script field that places code as described: "Output before the closing head tag, after sitewide header scripts. "
Hi Aaron,
I assume the hook elements of GP would do the same.
https://docs.generatepress.com/article/hooks-element-overview/
For example, for before the closing body tag, we could usewp_footerhook.
https://docs.generatepress.com/article/wp_footer/
For more info, check this list:
https://docs.generatepress.com/collection/hooks/
Finally got around to implementing this, worked great. Thanks for the help!
You are welcome :)