How to integrate Google+ into your WordPress plugin

A guideline for wordpress plugin developers.

Now that the Google+ Button is available to use, I had the idea to integrate it into my WordPress Plugin. A little bit of linklove can not be wrong and SEO is important, also to spread an open source product.
Here you can read about what to do so.

Add Google + to WordPress image

First of all, the +-Button consists of two parts:

  • The plusone.js script in the html head.
    <script type=”text/javascript” src=””></script>
  • And the button place holder
    <g:plusone size=”small” count=”false” href=””></g:plusone>

Both parts can easily integrated with standard wordpress functions.

To add the script into the wp-admin head you can use this code:

function set_admin_header() {
  //admin Header
  wp_register_script( 'plusone', '');
  if (function_exists('wp_enqueue_script')) {
add_action('admin_init', 'set_admin_header');//admin_init, admin_head is to late

For integration in a plugin-class, use this instead:

$classObj = new myClass();
add_action('admin_init'   , array($classObj,'set_admin_header'));


Then you need to integrate the button into the plugins overview / wordpress installed plugins list.

/* Add a link to plugins page */
function set_plugin_links($links, $file) {
  $plugin = plugin_basename(__FILE__);
  if ($file == $plugin) {
    return array_merge( $links, array(
      '<g:plusone size="small" count="false" href=""></g:plusone>'
  return $links;
add_filter( 'plugin_row_meta', 'set_plugin_links', 10, 2 );

For integration in a plugin-class, use:

$classObj = new myClass();
add_filter( 'plugin_row_meta', array($classObj,'set_plugin_links'), 10, 2 );

After all, replace “” in my code with your url.

 I hope I could help you with my short tutorial. If so, please click on my + button ;)

Tagged with: , , ,
Posted in wordpress
2 Comments » for How to integrate Google+ into your WordPress plugin
  1. Wee says:


    So do you mean that this update actually allows you to put the +1 button onto the plugin page or somewhere on the users’ blog?


    • admin says:

      This is a guideline for plugin developers. You can see the result if you install my “nextgen scroll gallery” plugin.

1 Pings/Trackbacks for "How to integrate Google+ into your WordPress plugin"
  1. [...] How to integrate Google+ into your WordPress plugin – BMo-design Demos [...]

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

More aboute me
Give me a +

donate my work ♥ → paypal