Skip to content

June 8, 2011

4
 

HowTo: Add goOgle “+1” button to your website

[To know about goOgle’s +1 Button navigate here]

How to add “+1” button on my website/blog?

On 1st June 2011 goOgle rolled out +1 Button for Websites so that you viewers can +1 their articles right from the page and their connections would be able to see their recommendation on the search page.

All you need to do to add “+1 button” to your website is to insert just two lines of code. (Yeah! Its that simple!)

Place this line of code in your head section or just before you  close the body tag:


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

then place this code where you want your “+1 button” to appear on page.

<g:plusone></g:plusone>

The URL to +1 is determined by one of the three things given below (and in given order):

1) The href attribute  defined in the <g:plusone> tag
E.g.:

<g:plusone href="http://blog.snehilkhanor.com/"></g:plusone>

2) rel attribute of <link> tag
If href attribute of plusone tag has not been set then goOgle looks for the href attribute in the link tag and rel attribute’s value.

E.g.:

<link rel="canonical" href="http://blog.snehilkhanor.com/" />

3) URL of the page
If both the above values are not specified then goOgle looks for the URL of the page as defined in document.location.href i.e the URL as found in DOM.

Note: If you want to onfigure this in WordPress you can use the function get_permalink(); to echo the url of your post.
E.g.

<g:plusone href="<?php echo get_permalink();  ?>"></plusone>

or you can make use of the canonical URL defined by wordpress in the head section of your every post.

This is just the basic stuff If you want to customize your +1 button to more extent you can goto through this page and learn about changing the size of button or showing or hiding the count of your button etc.

By default <g:plusone></plusone> will render as:

<g:plusone size="standard" count="true"></g:plusone>

The size attribute can take values: small, medium, standard, tall

and count attribute can take values: true, false

Thats all about Adding and customizing goOgle +1 button on your website/blog.

Do share in comments how you like this article and if you experience any difficulty and seek little help.

 


Warning: Missing argument 1 for BaseDD::BaseDD(), called in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-manual.php on line 123 and defined in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-class.php on line 97

Warning: Missing argument 2 for BaseDD::BaseDD(), called in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-manual.php on line 123 and defined in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-class.php on line 97

Warning: Missing argument 3 for BaseDD::BaseDD(), called in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-manual.php on line 123 and defined in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-class.php on line 97

Warning: Missing argument 4 for BaseDD::BaseDD(), called in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-manual.php on line 123 and defined in /home4/snehil/public_html/addon-domains/snehilkhanor.com/sub-domains/blog/wp-content/plugins/digg-digg/include/dd-class.php on line 97

Like what you read? Like Binary Log on FaceboOk or Subscribe to My Binary Log via Email or .


Share your comments .. 🙂

About the author

Snehil Khanor wrote 131 articles on this blog.

Snehil Khanor - Entrepreneurial Spirit, Techie, Gadget Freak, Blogger, Dreamer, Internet Visionary, Foodie, Delhiite, Wannabe Artist ,To-be Engineer with a heart of a Poet. 😉

Incoming search terms:

  • element g:plusone undefined

Related Posts:

4 Comments Post a comment
  1. Jan 16 2012

    Hello!
    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!

    Reply
  2. Sep 22 2016

    This, of compare viagra cialis discount generic tadalafil tadalafil , is the familiar doubt for worthiness impact.

    Reply
  3. Nov 4 2016

    Athletes Your data remains how including of of and conditioning for to encourage buy generic cialis ottawa.

    Reply
  4. Mar 3 2017

    cialis online get cialis cheapest (tadalafil) for Erectile Dysfunction: My Dr.

    Reply

Leave a comment to dotNetFollower Cancel reply

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

required
required

eXTReMe Tracker