Adding code to the headerfooter

blog cover image
30
5.4K followers
Updated

Insert Headers and Footers Plugin


A tip when adding code/script in the theme editor and header/footer

Sometimes during the training, we find we need to add some background code or a script to the header or footer of our website theme.

I've found it very easy to use the "insert header and footers" plugin. This makes it very easy to insert the code or scipts needed.


A script code will start with

<script......

and end wilth </script

Everything between those tags is the code or script.

You can learn more about the script HTML CODE here and more HERE

Sometimes you will find that a description is added for you as a comment before the start of the script.

<!-- This is a comment. Comments are not displayed in the browser -->

example:

<!-- Global site tag(gtat.js) - Google analytics -->

<!-- COMMENT added -->

The <!-- tells us the text is not part of a script but only a comment and is not to be read and executed

The --> This ends the comment part of the code

You can learn more about the comment HTML CODE HERE

But to remind yourself of what the code is there for, you can add a description above where the code or script starts.

EXAMPLE: This is the script I inserted when setting my site up for GA to add my unique ID:

<!-- Global site tag (gtag.js) - Google Analytics --> (this is the comment)

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-54074243-10"></script> (this is the script)


TIP, when adding a new script to the header/footer, add a couple of blank lines between the scripts so you can more easily tell where they start and stop.

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core “Business Start Up” Training

Recent Comments

21

Can you use this plugin with ANY theme?

Yes.

I never thought there is a plugin for that.

Thanks Shirley. I’m clueless with this stuff

Can be a little bit tricky at times will keep the plugin in mind for those moments. Regards Shane.

Hi Shirley, thank you very much for the information. Much appreciated. Will this work for adding affiliate links also

No. Affiliate links go within the BODY SECTION (which is the part you create your blog text in) you get the affiliate links from the merchant's website using the method they instruct you to get them.

A good plugin really helps, doesn't it?

yes, I love it.

Thanks, Shirley, that's really helpful.
Colette and Philip

Thanks Shirley...I have forgotten some of the coding in html and this is a good reminder of it.

It’s been such a long time since I used it.

Bob

I use this plugin too. It’s great and very flexible.

See more comments

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core “Business Start Up” Training