How to Add your HTML Code to your Theme Header

Last Update: April 16, 2018

I have seen several people looking for a way to add their verification code to their header so I am going to do a walk through so It might help. Be very careful when you are working with in the code of your website, if you delete or copy to the wrong place it could mess up your site. I don't know a lot about code but I have played around with it enough to be able to follow directions with in the code to do small thing's.

First thing you want to do is copy the HTML code you are going to be using for verification

So highlights the code, right click on it and then click on copy.

Go to your dashboard if your website

Scroll down to Appearance click on it and you will see the editor at the bottom of the drop down box


Click on the Editor

if you see this and feel comfortable doing this click I Understand

and you will see a page like this


If you look to the right, it shows's you the Theme Header, or (header.php) click on that, and it will take you to a page where you will be placing the HTML code you copied earlier, for the verification code.

Here is your Theme Header HTML I have already put the code in for my Google Adsense account as you can see in the picture

You will see:

Line 9 which looks like this

9) ?><!DOCTYPE html>

Line 10 will look like this

10) <html <?php language_attributes(); ?>>

and line 11 will look like this

11) <head>

now after the <head> you want to right click and paste the HTML verification code an will look like this


<head> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-4339841485359943",
enable_page_level_ads: true
});
</script>

Make sure you update your setting at the bottom and then go back to the affiliate site where you got your HTML, and click on verify, it will tell you if it went through or not, if not then you need to go back and highlights the HTML you just copied and delete it, save your settings and the then past the text (HTML) again

But please just be careful when you are doing this, as I said working with in the code could cause a mess up in your site or cause it not to work at all.

I hope this helped

Wishing you all the best and if you need any help before you start just let me know.

VickiG

Join the Discussion
Write something…
Recent messages
JerryMcCoy Premium
Thanks
Jerry
Reply
MarionBlack Premium
Code added to the header can break a website and may get overwritten next time the theme is updated. It's so much safer to use the 'Insert Headers and Footers' plugin by WPBeginner.

I show how to use the plugin in this video
Reply
KristylaureL Premium
It seems so easy.. just scary :) Gotta get my feet wet though. Thank you so much! That was the easiest lesson regarding this topic I have reviewed.
Reply
JillAlexaVA Premium
Whew! That all seems very complicated to me at this point. Thank you.
Reply
VickiG Premium
You are welcome and it looks complicated if you have never tried it and Loes has given us an easier way ant that is with a plugin. you can simply look for it by going to the dash board and to plugin's on the left of the screen, then click, add new and type in that way
Header footer script, I have never used it but will try to see what it is like. Stay smiling :)
Reply
Loes Premium
I use the header footer script plugin for that matter
Reply
VickiG Premium
That is a good thing but for small thing's instead of using another plugin I just use the editor but thank you for adding this, it would probably be safer for someone who does not want to mess around on the code. Maybe you could let us know which one you prefer.
thank you Loes
Reply
Loes Premium
It is called that way
Header footer script
Reply
VickiG Premium
Than you for sharing I know it will be very helpful
Reply
Top