Adding Adsense and other code to your website without using a plugin
A lot of people wonder how to add Adsense and other code to your header without using a plugin. Well, WordPress actually makes this quite easy.
From your Admin portal, simply navigate to Appearance --> Editor, then click on Theme Header (header.php).
If you have been instructed to add the code to the head of your site, find the </head> tag and place your code on the line before that tag.
If you have been instructed to place the code at the beginning of the body of your page, find <body tag and place your code on the line after that tag. Some times you will see <body> other times it can be something similar to <body <?php body_class(); ?>>, Which ever way it is, make sure you place the code on the line after the closing > symbol.
If you have been instructed to place your code after the body click on Theme Footer and find the </body> tag. Place your code after this tag.
Please keep in mind that depending on the theme, it may overwrite these settings when you upgrade the theme, so always keep a backup of the code and check when a theme is updated. It is because of this reason that a lot of people use a plugin for this, but if you do not want the overhead of a plugin, this is the easiest and most efficient way to accomplish this task.
Recent Comments
1
Thanks for sharing this information!