Site logo

Archived topic

How to add Javascript to the home page template of my website?

3 replies · Started by Asen on December 2, 2021

Viewing posts 1–4 of 4

Hey guys,

How can I add the following code

<script type="text/javascript" src="http://classic.avantlink.com/affiliate_app_confirm.php?mode=js&authResponse=929cefcba486cd82cedd9d1666a22556e88f2a2f"></script>

Here:

1. The JavaScript can be placed in one of the following places:
Locate your homepage. This is probably named "index.html" or "index.php" in your web root directory (likely to be named "public_html"). You may need to check with your host to determine what file this is. Paste the JavaScript anywhere in that file and save the file to your web server.
2. Paste the JavaScript anywhere within the template that is used on the homepage of your site.

What's the easiest way to do this with GP?

Many thanks for your help!

Regards,

Asen

Hi there,

you can use a Hook Element:

https://docs.generatepress.com/article/hooks-element-overview/

Add your script to the content area.
Set the Hook to either:

wp_head or wp_footer

Either can be used by the sounds of those instructions, if thats the case then use the wp_footer for better initial loading performance.

Then set the Display Rules > Locations to: Front Page

Thanks for your help, David. Will try that.

You're welcome

This archived topic is closed to new replies.