Pin Me

Adding a Hit Counter to a WordPress Template

written by: Amanda Presley•edited by: Michele McDonough•updated: 6/16/2010

Do you want to add a hit counter to your site, but don’t want to add it to each individual page? You can add the hit counter into your WordPress Template. This tutorial will show you how to add the Hit Counter to your WordPress Template.

  • slide 1 of 4

    WordPress Hit Counters

    How to Add a Hit Counter to a WordPress Template - image Adding a Hit Counter to your WordPress Template is probably easier than you may think. In order to add the hit counter to the template, you will have to go into the theme editor and insert it in one of the templates on that page. Before we get started, go ahead and find a hit counter you want to use. Then get the code of the hit counter. Copy the code and leave it in your clipboard.

  • slide 2 of 4

    Locating the Template in WordPress

    First, step is to locate the template in WordPress. Login to your admin panel and click Design > Theme Editor. This is where all of the files are stored that are in the theme you are using for WordPress.

  • slide 3 of 4

    Choosing the Theme File in WordPress

    Now that you are in the Theme Editor panel, you will need to decide where you want to place the hit counter. For this tutorial, let’s say you want to paste the hit counter at the bottom of each page. In that case, we would paste the code in the footer file. Placing the code in the footer file will place the hit counter at the bottom of each page.

    So, that means we will need to select the footer file. On the right side of the box you are looking at, you should see the Footer (footer.php) file. Click that file to load the footer file in the theme editor window. Now you will need to look for the closing div tags. There will probably be at least two closing div tabs. There may even be more. You will want to paste the code you copied right before the first closing div tag.

  • slide 4 of 4

    Saving the File

    Now you will need to save the file to add the hit counter to your WordPress Template. At the bottom of the editor, you will see the Update File button. Click that file to save the changes you just made to your template. Now you can view your website to see your new hit counter.

    You are free to add the hit counter to any part of your template. If you mess the template up when you paste the code and save it, simply go back to where you pasted the code and delete the code. Then save the file. The template will go back to normal. Some hit counters use large ads that will throw your template out of whack. So, try to go with some simple ones.