A Safe and Easy Way to Add Code to A WordPress Website’s Header or Footer

There may be occasions when you need to customize your WordPress website, and the only option is to edit the underlying code of the theme you are using. The purpose of this customization might be to change the appearance of your website, or perhaps alter the way it functions.

In these instances, you can simply open up the relevant theme files and make those changes directly from within your WordPress website. However, this isn’t an ideal approach for a number of reasons.

Changing themes, or even updating your theme when a new version is released, could overwrite your customizations and additions. Furthermore, if you make a mistake while editing those files, you could find it difficult to retrace your steps and undo those changes. Worst case scenario: you could get locked out of your website, making it very difficult to make any further changes.

Even if your changes are successful, there could come a time in the future where you, or someone else might want to review those changes or deactivate them.

So as you can see, there are a number of issues that can arise when directly editing the underlying files that make up your website. Thankfully, there is a handy plugin available which allows you to safely insert code into the header and footer of your website, while also giving you an easy way to deactivate that code in the future.

Header and Footer Plugin for WordPress

That plugin is called Header and Footer and it’s one that has been created by developer Stefano Lissa.

This free plugin allows you to add code and other content to your theme’s header and footer sections. This could include an analytics tracking code, custom PHP or JavaScript, and anything else that can enhance your website by being inserted into the header and footer sections.

If you are following a tutorial or documentation and you are instructed to edit your website’s header or footer, using this plugin gives you a safe way to do so.

How to Use Header and Footer on Your Website

As the Header and Footer plugin is free to use, it can be installed on your site directly from the WordPress plugin directory.

To do so, log into your site’s admin area (http://yoursite.com/wp-login.php) and then navigate to Plugins > Add New using the sidebar menu.

From the Add Plugins screen, enter ‘Header and Footer’ in the search field and then install the first item listed in the results.

Header Footer Add Plugin

Once the plugin has been installed and activated, it can be accessed from the Header and Footer item under the Settings menu on the admin sidebar.

By selecting the appropriate tab, you can then write or paste your code snippet in the way that you want.

Header Footer Add Code

Now you’ve got an easy way to make additions the underlying code of your website. This approach also gives you the ability to easily keep track of, and review your changes.

More information on using this plugin can be found in the Header and Footer section of the developer’s website.

Conclusion

This plugin gives you an easy-to-use interface for adding code to the header and footer sections of your WordPress website. Hopefully, you should now be able to customize your website with confidence, and add additional code snippets as needed.

If you are looking for a safe and easy way to add code snippets to the functions.php file of your website, without editing that important file directly, then the Code Snippets plugin is another good option.

If you have any questions about this plugin, or using WordPress in general, please leave a comment below.

New Posts in your inbox