How to add the Google +1 button to your WordPress blog

by Adam McLane on June 18, 2011

Google +1You may have noticed the Google +1 button showing up on your favorite websites and blogs. (e.g. Mashable) This is Google’s response to Facebook’s über popular Like button that appears on just about every website on the planet.

There are a two plugin options for adding it to your WordPress self-hosted blog.

  1. Install a Google +1 plug-in (Simple enough)
  2. Install the AddThis plugin, which includes Google +1 along with a myriad of other services. (Also simple, free account required)

But if you are looking for a little more control than a plugin can offer you, here’s how to add it by yourself.

Level of difficulty: Easy

Time Needed: Less than 10 minutes

Note: If you use the Thesis framework, do not use this tutorial. Also, if you upgrade your theme you may need to repeat this procedure.

Step 1

From your dashboard, scroll down to the Appearance section and click Editor.

Step 2

From the Theme Editor, select your Header file. (Default theme Twenty Ten shown below, most themes have a similar file.)

Step 3

Find the </head> tag. Insert the code below in the line immediately before </head>

To save, click Update File.

Note: You can acquire this code directly from Google here.

Step 4

This step varies from theme to theme, but for most you will select the Main Index Template to edit next. (Most likely alternative is Comments.)

Step 5

Decide where you’d like to put the Google +1 button. I like to place things like this between the main content and the comments, but you can move it around wherever you’d like and it should work the same.

For Twenty Ten, to place the button between the blog post content and the comments, I pasted the code below just below the <!– #comment –> tag.

Once you’ve done that, click Update File and you are done!

Note: To see all of the size options, visit the Google +1 page for webmasters.

BONUS

Why stop there? Why not add a little McLane Creative Monster Sauce to the thing by including a Facebook Like Button and Twitter Retweet Button? Swap out the code below for Step 5 to get the results above.

Questions? Leave a comment or head over to the WordPress Help Center and start a topic.

Like this post? Help me out by giving it a Google +1, Retweet, or Like.

Bookmark and Share

  • http://www.seventy8productions.com/ Jeremy Smith

    One of the biggest attractions with the WordPress plugins is the ability to “hook” into the website when it loads so that you can just insert these things into your theme without ever having to change the code. So for the casual user, don’t edit the theme because you will have to do this over and over. For the more experienced one, it might be just as simple to install those two plugins.

  • http://mclanecreative.com Adam McLane

    Pretty much agree. Though very rarely does a theme get updated or need to be updated. (More likely with the example I gave with Twenty Ten than just about any other theme.)

    I’ve encountered a bunch of people frustrated with the lack of total control with the plugins. The AddThis plugin is great, but tons of frustration caused by the Twitter part of it. (via @addthis)

  • http://goinswriter.com/ Jeff Goins

    Interesting. Still seeing if +1 has any SEO merit. Thanks for sharing.

  • http://www.gavoweb.com Gavin Richardson

    I was thinking that you could just put in the code into a theme’s Hooks.

  • http://mclanecreative.com Adam McLane

    Indeed, that’s how we do it for clients.

  • http://net-follower.myopenid.com/ dotNetFollower

    Nice post!
    In my blog I described how to add Google +1 Button to every WordPress blog post in respect to iNove theme. I added the +1 button manually editing php files. Probably, it could be useful for someone. The article is here – WordPress: How to add Google +1 Button to WordPress blog post.
    Thanks!

Previous post:

Next post: