How to Add Scripts to Header and Footer in a WordPress Site

The most common way to add any code is to go to Appearance ⟶ Theme Editor, Select the current theme and head over to the header.php or footer.php and put the codes right before where it says <head>.

This is useful for putting any type of code, be it Google Analytics tracking codes, Javascript codes that are given by Ad Networks such as Google Adsense, Media.net etc, or meta tags to verify site at Webmaster Console or at any other service

But there are certain people who don’t feel comfortable to edit their themes. There is an easy solution for it which requires no code editing.

The Add Footer and Header plugin helps you add anything in the footer or the header of your site.

Simply install the plugin and go to the plugin options page where you will find the boxes, one for header and footer each. Put the codes where you want to.

This plugin is helpful especially when you have WP Touch Plugin installed to create a mobile version of your site. It isn’t easy to edit the WP-Touch theme and neither there is a way to put codes directly into the template.

Install Add to Header and Footer Plugin

Footer_Header_AddCodes01

You can do to Plugins ⟶ Add New, then type ‘Header & Footer’ and install the Header & Footer plugin which is approx 80000 installs so far.

Once you install it, you will find the Plugin options under Settings ⟶ Header & Footer. You can put the codes in the Footer. The plugin gives you different options to insert codes. Other than Header & Footer, you can put anything Before or After the posts or even in the middle of the content by mentioned of a number of character the element should be visible.

Footer_Header_AddCodes02

While verification or analytics codes should be added to the Footer section of the plugin, other areas are useful for putting Ad Codes that will show Ads. This is an extra feature and can be helpful if you are not already using Quick Adsense Reloaded plugin.

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

NO COMMENTS

LEAVE A REPLY