02 Jun June 02, 2011

How to Add Google +1 Button to Your WordPress Website

Eileen Lonergan 0 Blogging, WordPress Design

If you would like to embed the +1 in your blog, you may use the Google +1 plugin, go to Google Webmaster Tools, or use this code inside your themes functions.php file:

/* Add plusone.js to section of your theme */
add_action (‘wp_enqueue_scripts’,’google_plusone_script’);

function google_plusone_script() {
wp_enqueue_script(‘google_plus_one’, ‘https://apis.google.com/js/plusone.js’, array(), null);

/* Add +one button after your post content by using filter */

add_filter(‘the_content’, ‘google_plus_one’);

function google_plus_one($content) {
$content = $content.’

return $content;

You can style and align button in post text by applying following class

Add this code in your theme’s style.css if you want to align it to left:

display: inline;
float: left;
margin-right: 20px;
margin-top: 4px;

And add this code in your theme’s style.css if you want to align it to right side:

display: inline;
float: right;
margin-left: 20px;
margin-top: 4px;
It’s all about +1 this week, Google’s new sharing tool. According to Google +1 is:

The +1 button is shorthand for “this is pretty cool” or “you should check this out.”

Click +1 to publicly give something your stamp of approval. Your +1’s can help friends, contacts, and others on the web find the best stuff when they search.


If you want to enable +1, click here and you will see the massive Try Now button, a simple click and you will be all set.

Related Posts with Thumbnails
Pin It
Eileen Lonergan
This is my blog and I hope you enjoy it. I try to share tips and tricks that I have learned about WordPress and digital marketing, which hopefully will make your life a bit easier. I have been working on search engine marketing for clients since 2003.
Eileen Lonergan