How To Add Header And Footer Code In WordPress – Short Course
Not every theme has a built in section for adding codes and scripts in the footer or header of the website. On Yosaki we use Braxton theme, It does not have that option too however, I managed to add scripts / codes in my footer using a WordPress plugin.
Scripts you can add to your WordPress footer / header using this method include; Affiliate code scripts, Google Analytics scripts, Flippa scripts, Bing Webmaster script and so much more.
To solve this problem, we tested two simple Plugins and these include; Insert Headers and Footers” plugin developed by WPBeginner & Header Footer Code Manager. Both Plugins require the latest version of WordPress – so if you have an outdated version, please go to Updates and click on Update WordPress).
The plugin has a very simple interface which gives you a chance to insert codes & scripts in your WordPress website’s header / footer.
FEATURES OF INSERT HEADERS & FOOTERS PLUGIN:
- Quick to install
- Simple to insert scripts
- Insert header code and/or footer code
- Add Google Analytics code to any theme
- Add custom CSS across themes
- You can insert Facebook pixel code
INSTALLATION & CUSTOMIZATION:
Step 1:- Go to Plugin -> Add new
Step 2:- Seacrh for ”Insert Headers and Footers”
(The screen shoot above show an active ‘’Insert Headers and Footers’’ plugin on Yosaki. On your blog / website it will ask you to install & activate the plugin)
Step 3:- Go to Settings -> Insert Headers and Footers
Insert the code you have got from a third party in the header or footer. Please don’t edit scripts or codes. All you have to do is to copy and paste them and then click SAVE button
You can as well add header and footer codes / scripts using ”Header Footer Code Manager” plugin. With this plugin, you can easily add tracking code snippets, conversion pixels, and other related scripts which require insertion at the header or footer of your WordPress website.
- You can add unlimited number of scripts and styles anywhere and on any post / page (gives you more options than the 1st plugin)
- You can easily manage which posts or pages the script loads
- It supports custom post types
- It can load only on a specific post or page, or latest posts
- You can control where exactly on the page the script is loaded – head, footer, before content, or after content (you will be 100% in control)
- Enable / Disable script on desktops or mobile.
- Use short codes to manually place the code anywhere
INSTALLATION & CUSTOMIZATION:
Step 1:- Go to Plugins -> Add New -> Search for ”Header Footer Code Manager” -> Install Plugin
Step 2: – Activate plugin
Step 3:- Click on HFCM -> Add new (snippet)
To add a new snippet, you have to do the following:
- Snippet name
- Select if the code should display ‘’ Site wide on every post / page, On Specific post, On Specific page, On Specific category, On Specific tag, Specific custom post type, Latest posts only (you choose how many), Manually place using shortcodes’’
- Choose a location; header, footer
- Choose device display: Show on all devices, Desktop only, Mobile only
- Activate the snippet (if you don’t activate it, it won’t display)
- Insert Code / Script
- Click Save
The good thing about ‘’Header Footer Code Manager’’ plugin is the ability to add codes / scripts to specific posts / pages / categories/ tags.
Step 1:- Create a snippet name
Step 2:- Go to Site Display -> Choose -> Specific Pages
Step 3:- Select a location where the script should go (header / footer)
Step 4:- Choose devices to display the script (could be all devices, mobile devices, desktop)
Step 5:- Activate
Step 6:- Save the snippet.
If you want to add scripts / codes to categories, latest posts and pages. Follow the same steps above.
After saving your snippet, you will get a short code – insert this code in a page / post you selected.
To view all created snippets.
Click on – HFCM -> All Snippets
Hope you found this post ON ”How To Add Header And Footer Code In WordPress’‘ helpful. If so, please share it and help other people like you find this solution.
- 1 METHOD 1:- Insert Headers and Footers Plugin
- 2 FEATURES OF INSERT HEADERS & FOOTERS PLUGIN:
- 3 INSTALLATION & CUSTOMIZATION:
- 4 METHOD 2:- Header Footer Code Manager
- 5 FEATURES:
- 6 INSTALLATION & CUSTOMIZATION:
- 7 Adding Scripts / Codes To Specific Pages / Posts Using ”Header Footer Code Manager
- 8 If you want to add scripts / codes to categories, latest posts and pages. Follow the same steps above.