How To Install Google +1 Button In Thesis Theme Without Using Plugins

I have recently installed thesis theme because of its flexibility and search engine friendliness. I also loved the simplicity in the default layout. I have been looking for ways to socialize the blog and one way to do it is by using social networking buttons like Facebook share, Twitter tweet and Google +1 button. I have installed all the three buttons without using any plugins. This makes sure that my theme and site looks fairly good and does not get into problems with WordPress gets updated.

Let’s look at how to add Google +1 button to Thesis theme manually without using any plugin. First you should go to Google +1 button page and select the button you want to insert in your theme. You will get the code for the button below the selection. There are two sections in the code. One piece of code should be installed in the header of the blog or in the footer just before the closing BODY tag. The other piece of code should be inserted where you want the button to appear.

Open WordPress admin panel and go to Thesis Site Options. Expand Document Head –> Additional Scripts. Copy and paste the first script given by Google in the text area. The code should look like this:

<script type=”text/javascript” src=”https://apis.google.com/js/plusone.js”></script>

additional scripts adding google plus one code

Then go to Thesis Custom File Editor. Select Custom_functions.php from the drop down menu and click Edit selected file. Copy and paste the following code at the end of the text:

function add_google_btn ()  {
if (is_single()) { ?>
<div style=”float:right; padding-left:3px;”>
<g:plusone size=”tall”></g:plusone>
</div>
<?php   }}

add_action(‘thesis_hook_before_headline’,’add_google_btn’);

Copy and paste the Google’s second piece of code in the above code where I have highlighted it. This will add the Google +1 button at the right of the article title. You can see this page as an example. It consists of Twitter button, Facebook Like button and Google +1 button vertically aligned on the top right of the article title.

If you want to add Twitter and Facebook buttons manually using the same code, kindly let me know through comments and I’ll give you the complete code.

Post Comment