Wednesday 27 July 2011

How to add google +1 button to wordpress post page?

 All you know that google recently launched google+, and it has the high features for sharing the website content( Promotion).Google +1  button is one of the feature of google+ for social recommendation. This feature is like facebook like button.


Here are the simple steps to add +1 to wordpress post page or archive page.

Get the code from Google+

The code will be like this.

<! -- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<! -- Place this tag where you want the +1 button to render -->
<g:plusone href="http://www.greatnewmovies.com"></g:plusone>

Now open your theme header file and place the following code in the header file before </head> tag.

<! -- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>

Then we need to place the +1 button. Open your sinle.php file and place the following code in the file where you want to render the button.

<! -- Place this tag where you want the +1 button to render -->
<g:plusone href="<?php the_permalink(); ?>"  size="small" ></g:plusone>

Here we have the option to change button sizes.

Size="small"  - To display small size +1 button of 15px
Size="medium" - To display medium size +1 button of 20px
Size="large" - To display large size +1 button of 60px

That’s it .This will display +1 button on wordpress post page.


Enjoy Sharing.

No comments:

Post a Comment