Monthly Archives: July 2011

Google +1 button position

I'm using the Google+1 button plugin for wordpress to add a Google+1 button on my blog.

The plugin is great but it registers a filter to add this button and there are other plugins installed that also register their own filters on the body. What I would like is to have google+1 , facebook like and the official tweet button all on one line.

This would be easy if I would not have the contextual related posts plugin that puts the links to the posts right between the google+1 button and the facebook like botton.

Most plugins that add something to a post or page have a way of adding it manually, through a template keyword but this is not useful as I don't want to remember to add all the buttons at the end of each post.

The next solution would be to use the function that outputs the button code in the template. But this needed a small modification to the google+1 plugin.

Here's the patched version of the google+1 plugin version 1.0.4
The google+1 button plugin patched- (125.49 kB)
And here's the unified diff file in case you want to apply it over your plugin and to see what really changed:
The google+1 button plugin diff -0.1 (917 bytes)

Now you can just use this code inside the posts loop ( after or before the the_content ):

  2. < ?php if(@$Wdgpo_pp) { echo $Wdgpo_pp->codec->process_plusone_code(); } ?>

This was a quick change to get this done. A better solution would be to modify the plugin to allow you to set the filter order ( priority ) so you can control the position from wordpress admin like you can do it in the wp facebook like and wp tweet button plugin.

Oh and don't forget to +1 , like and/or tweet this post 🙂