Quicktip: How to Find and Use the Head Tag in WordPress

Disclosure: We are a professional review site that receives compensation from the companies whose products we review. We test each product thoroughly and give high marks to only the very best. We are independently owned and the opinions expressed here are our own.

7 Flares Filament.io 7 Flares ×

1304606924_wordpress As a website owner, you might be asked to add a line of code to your website. Sometime it is simple as adding it somewhere in the theme. But lets say you want to add  web analytics software on your site. Programs such as Google Analytics and many others ask that you add code to your head tag on every page of a site.

The first thing you want to do is look for a plugin that will add the wanted code to your head tag. Just keep in mind, that the more plugins you add to WordPress, the slower your site will run. So if you have a lot of code to add to your site, look into the All-in-One-Webmaster  Plugin if you are adding a bunch of analytic code.

If you have to many codes/scripts to add or you can not find a plugin that works, then you will have to add the code to the head tag yourself.

Adding code to the header of your WordPress Blog is easy. WordPress made it simple, by adding editor to your admin panel. The editor will allow you modify your theme’s code. To access the editor, Log in to your dashboard and good to your appearance section and select editor. Once you get into the editor you find a list of files that can be edited. You will need to select a file called header.php.

Once you open your header.php file, make sure to backup the code. Just copy your code and pasted it into a notepad file and save it. If you do not save the file and you overwrite the code, you will break your website. You will have to delete your theme and reinstall it or even worse, you might have to find the individual file and upload via FTP to get the right file in place.

Below is a screenshot of what my header file looks like.

header-file In the red box you can add your code. Just make sure its in between the head tags.

[html]<head> </head>[/html]

 

In some themes, you may not have the option to update the header file. This could because you are using a child theme, such as StuidoPress. If this is the case with your theme, look for a plugin called Hooks or open hooks. Basically it adds custom fields to your dashboard to allow to modify your child themes without the worry modifying the original files.

Also keep in mind, your theme has an upgrade and you upgrade, then you will loose your changes to the files. Your best is to keep those codes in a notepad file with instructions on where the code goes you can easily add it back after the upgrades.

Image Source: Inconfinder

 

EvolutionaryDesigns.net runs on the Genesis Framework

Genesis Framework

Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!


Take advantage of the 6 default layout options, comprehensive SEO settings, rock-solid security, flexible theme options, cool custom widgets, custom design hooks, and a huge selection of child themes ("skins") that make your site look the way you want it to. With automatic theme updates and world-class support included, Genesis is the smart choice for your WordPress website or blog.

About James

James spends most of his free time using social media and loves to teach others about design, web development, CSS, SEO, and social media. He is addicted to Wordpress, social media, and technology. You can reach him on his, personal website, Do not forget to follow him on Twitter @element321

Comments

  1. Great tips there James, there has been many a time when I’ve done this myself then wwhen theme updates it goes, a similar thing happened to me when I updated the widget code in wordpress for RSS feed to be nofollow and had to remember to re-edit after a WordPress update 😉

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

7 Flares Twitter 6 Facebook 1 Pin It Share 0 Buffer 0 Email -- Filament.io 7 Flares ×
%d bloggers like this: