Google Buzz Count Button For WordPress

You can skip all my monologue and get the Google Buzz Count Button Code for WordPress straight away ;)

Google Buzz Count Button For WordPress
Google Buzz Count Button For WordPress

I’ve been looking for a simple code allowing me to add Google Buzz count button to WordPress blog but I couldn’t find one. I did little bit of research and figured it out by myself.

If you want Google Buzz button for just single page then you can easily get it from Google Buzz Buttons page.

However you can’t use that buzz button code in WordPress blog as that code doesn’t support dynamic parameters such as url, excerpt etc.

Google Buzz API provides the solution for adding Buzz count button to WordPress.

Here is the complete code which you can copy and paste in the single.php file inside the loop.

[sourcecode language=”javascript”]
<a href="http://www.google.com/buzz/post"
class="google-buzz-button"
title="<?php the_title(); ?>"
data-url="<?php the_permalink() ?>"
data-locale="en"
data-button-style="normal-count"></a>
<script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script>
[/sourcecode]

The code is straight forward.

You can see live example of Google Buzz coutn button on this blog itself, scroll up to see the Buzz count button below the post title.

There is one more parameter data-message=” “, which you can add in the code. However it is better to leave it empty so that it gives empty box to buzzer to write their own comment.

To Do

I’ve to work out how to attach thumbnail image to the Buzz post.

Finally managed to get the image url as well. See the code below which is a complete Google Buzz Count Button code for WordPress.

You can also show the data-message parameter. However you might see <p> </p> surrounding the excerpt.

Excerpt shows
Excerpt shows <p> </p>

To remove <p> </p> you can use the_excerpt_rss() function instead of the_excerpt().

the_excerpt_rss() worked on Bollywood blog but it didn’t work on Indian Recipes blog.

Code for Google Buzz Count Button for WordPress

[sourcecode language=”php”]
<?php $imgarr = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘thumbnail’ ); $imgurl = $imgarr[0];?>
<a href="http://www.google.com/buzz/post"
class="google-buzz-button"
title="<?php the_title(); ?>"
data-url="<?php the_permalink() ?>"
data-message="<?php the_excerpt_rss() ?>"
data-imageurl="<?php echo $imgurl ?> "
data-locale="en"
data-button-style="normal-count"></a>
<script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script>
[/sourcecode]


Comments

2 responses to “Google Buzz Count Button For WordPress”

  1. Hi Ajay,
    Did you figure out how to add thumbnail image url in the Buzz Button?

    1. Didn’t have time, may be someone can help me out here ;)

Leave a Reply to Ajay Cancel reply

Your email address will not be published. Required fields are marked *