Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Add Header and Footer Code in WordPress? Easy Way

Don’t know How to Add Header and Footer Code in WordPress?

WordPress stands as an unrivaled platform, empowering millions of users to create and manage their online presence effortlessly. The CMS offers huge built-in features to build highly customizable websites. But the problem is, by default, WordPress does not offer any option to inject code into the header and footer.

Sometimes we need to add some third-party code for tracking, SEO, and much more. So, how do you will do that?

Don’t worry, In this guide, I will walk you through the easy process so that you can add header and footer code to your WordPress site easily. You do not need any coding knowledge.

So, without further ado, let’s explore the methods!

Also read: How to add WordPress RSS Sitemap to Google Search Console?

Why do we need to add Header and Footer Code in WordPress?

Adding header and footer codes can be necessary for various reasons. Here are some common reasons why we need to add header and footer code in WordPress:

Integration of Third-Party Services: Many services and tools, such as analytics tools (Google Analytics), advertising platforms, and social media widgets, require you to add a specific code snippet to the header or footer of your website. 

Custom Styles and Scripts: If you want to add custom styles or scripts to your WordPress site, placing the code in the header or footer is a common practice. This could be for custom CSS styles, JavaScript functions, or other enhancements that aren’t covered by theme settings or plugins.

Meta Tags for SEO: Search engine optimization (SEO) often involves adding specific meta tags to the head section of your website. These meta tags provide information to search engines about your site, such as title, description, and verification codes.

External Fonts and Resources: If you are using external fonts or resources that require loading scripts from other servers, these scripts are often added to the header or footer to ensure proper functioning.

Also read: How to add Google fonts to CSS on WordPress website?

How to Add Header and Footer Code in WordPress?

Adding header and footer codes is easy. There are two methods to add the codes. Let’s see the methods.

Method 1: Add Header and Footer code manually

You can add header and footer code without using the plugin. If you have some technical knowledge, this method is for you. But there are some limitations. If you update your theme, you need to add the code again. Because new updates overwrite the header and footer files. Besides, if you change the theme you also need to add the codes again. 

Now let’s see how to add header and footer code manually. Login your WordPress Dashboard and go to Appearance >> Theme file editor.

Click on the “I Understand” button. Now select your currently active theme. By default, the active theme is selected. Now you will see the theme header and theme footer file.

Now click on the file where you want to add code. Once the code is added, Click on the “Update File” button at the bottom of the editor.

Method 2: Add header and footer code using a plugin.

This method is very easy and effective. You just need a plugin to your site. So let’s see the full process.

First, we need to install a plugin. Go to WordPress dashboard >> Plugins >> Add new and search for Header Footer Code Manager and install the first plugin.

Now go to WordPress Dashboard >> HFCM >> Add New. You will be redirected to a new page. Now enter Snippet Name, select Snippet Type and Location. Scroll down and you will see a big area and paste your code there. Now click on the “Save” button.

So we successfully added our code. This method is safe and easy. If you change or update your theme, this code is still there. 

Also Read: How to connect MailChimp to WordPress?

Conclusion

In conclusion, adding header and footer code to your WordPress website is easy and you can do it manually or with the help of the plugin. Whether you’re integrating tracking codes, analytics scripts, or custom styling, the ability to insert code in the header and footer provides flexibility and customization options. 

If you use the theme file editor to add code, you will need to add that code again if you update the theme or change it. Besides, if you use a plugin, you do not need to add the codes again. I always recommend using a plugin.

So, I hope you will be able to add the code to your WordPress site header and footer easily. If you need any help the comment box is always open for you. Read more article from our Blog

The post How to Add Header and Footer Code in WordPress? Easy Way appeared first on WP Art Studio.


This post first appeared on WordPress Beginner Guide, please read the originial post: here

Share the post

How to Add Header and Footer Code in WordPress? Easy Way

×

Subscribe to Wordpress Beginner Guide

Get updates delivered right to your inbox!

Thank you for your subscription

×