How To Edit Header & Footer In WordPress
The header and footer are two of the most important elements of every website. Especially when managing a WordPress website, you’ll have to edit and customize your website header and footer countless times.
It’s always best to learn to do these tasks by yourself like how to edit the header and footer in WordPress, rather than running to a web developer or WordPress expert every time you need to add a script or an HTML tag to your website.
In this short guide, we’ll show you why and how to edit the theme header and footer in WordPress using multiple methods. It’s super easy.
Get everything you need to build your next website with one simple subscription. From $16 per month, get unlimited access to nearly 2 million WordPress themes, web templates, fonts, graphics, and photos.
What Is Header and Footer in WordPress?
Before we get into the details, let’s take a quick intro to headers and footers.
The theme header for WordPress websites is like the brains of the website design. It’s an element that is shown across every page on your website. Mainly because the header is where most of the important website code, tags, and scripts are stored. As well as showing your brand logo and navigation links.
The footer is just as important as the header. It’s also shown on every page of your website and it’s easily customizable. Unlike the header, you can add widgets to the footer as well.
Why Edit Header and Footer?
Eventually, you’ll have to edit the header and footer of your website. And you’ll have to do it every time you register for a new tool or service that integrates with your website.
For example, if you want to use Google Analytics to gather traffic stats or monetize with AdSense, you’ll have to insert a code script into the header of your website to integrate with each service.
There are many other services and platforms that require you to add a tag or a code to your website header. Even when adding your site to a search engine console.
You’ll also have to customize the website footer quite often. Especially if you want to add a copyright notice or even to add a sitewide sponsored ad.
How To Edit the Header in WordPress
Let’s see how to customize the theme header in WordPress. There are a couple of methods you can follow and we’ll start with the easiest method.
Note: This tutorial involves editing core theme files of your WordPress website. Before making any changes, make sure to backup your website and theme files. Use this guide to learn how to backup.
Method 1: Use A Plugin
The easiest way to edit the theme header and footer in WordPress is to use a plugin.
The Header Footer Code Manager is a popular free plugin that allows you to easily insert code to your theme header and footer without having to manually edit the core theme files.
Go to Plugins >> Add New and install the Header Footer Code Manager plugin.
After installing the plugin, you can easily add a code to your website header or footer by going over to the HFCM tab.
From here, you can organize all your tags and scripts in one place. And even enable and disable them with a single click.
To add a new script or code, just click on Add New Snippet. Select whether you want to add the code to the header or footer from the Location. And paste the code.
The plugin also allows you to customize how the code or scripts are loaded. For example, from the Site Display section, you can choose whether to load the script sitewide or only on specific parts of the website. Stick to the All option to load the script across your website.
Once you’re done, hit the Publish button to save the snippet.
Method 2: Edit The Theme Files
While using a plugin to insert code snippets is easier, we recommend that you manually add code to your header file. It will ensure your website can load code and scripts faster without having to load the snippets via a plugin.
Editing the theme header file is easy. Just make sure to backup these files before editing, just in case.
Go to Appearance >> Theme Editor and look for the Header.php file. This file contains all the code related to your theme header.
Whenever you need to insert a code, tag, or script, just add it into this file. Make sure that your code goes right before the closing </head> tag.
Once you make the changes, click Update File button.
How To Edit the Footer in WordPress
The theme footer in WordPress is much easier to edit.
Usually, you can add custom code and edit the copyright notice from the built-in theme customizer.
Go to Appearance >> Customize and look for the option for editing the footer.
If you want to add a script, you can use the Header Footer Code Manager plugin. Or add the code manually by editing the Footer.php file in the Theme Editor. It works pretty much the same as editing the header.
If your theme has a footer widget area, you can also add custom widgets from the Appearance >> Widgets section.
How To Add A Custom Header in WordPress
What if you wanted to customize the design of your theme header? Maybe change the colors or add a mega-menu?
That type of customization involves writing code and advanced experience in web design. But, as always, there are WordPress plugins you can use to get that job done.
Being able to easily edit and customize the header and footer is a skill every WordPress user should learn. It will help you manage your website more easily.
Also, be mindful when choosing a theme for your website. Make sure to look for themes with clean code to ensure you can edit elements such as header and footer without frustration.
Check out our premium WordPress themes bundle to get access to more than 60 high-quality themes for the price of one.
Looking for WordPress hosting? We use Kinsta. They offer world-class WordPress hosting, built to keep your website fast, secure, and always online.