Google published on 01 June the possibility to add Google +1 to your page, which is a great service to add to the existing sharing services.

Im using Sharedaddy, and I will not install another extra plugin to support Google +1 and the Sharedaddy option to add a custom service is not prepared for dynamic services like this one. That’s because I looked to integrate the service into Sharedaddy avoiding to change to much the plugin.

Sharedaddy is Object Oriented, so its easy to create a new Sevice Class which extends Sharing_Advanced_Source. But to load your class, you need to change some files.

  • sharing-sources.php

    To make it dynamic, I created an extra file called sharing-sources-custom.php and load this file from the original Sharedaddy sharing-sources.php:

    // Custom Sharing services
  • sharing-services.php

    This file has an array with the current services and the class name for this service, here we must change directly the function to add our new class.

    private function get_all_services() {
    // Default services
    $services = array(
    'googleplusone' => 'Share_GooglePlusOne'

This two changes are enought to get your new service working, if you want you can also add images and edit admin-sharing.css to have preview in your admin panel, but the Service will be working without this.

Here is the Code for the Share_GooglePlusOne class:

 * @copyright Copyright (c) 2011, Marco Neumann
 * Licensed under the GNU GPLv3. 
class Share_GooglePlusOne extends Sharing_Advanced_Source
     * Button Size
     * @var String
    private $_size = 'small';

     * Button Language
     * @var String
    private $_language = 'en-US';

     * Button with count?
     * @var String
    private $_count = 'true';

    // Configuration extracted from
     * Available sizes
     * @var Array
    private $_optionsSize = array(
        'small'    => 'Small Size',
        'medium'   => 'Medium Size',
        'standard' => 'Standard Size',
        'tall'     => 'Tall Size'

     * Available languages
     * @var Array
    private $_optionsLanguage = array(
        'ar'     => 'Arabic',
        'bg'     => 'Bulgarian',
        'ca'     => 'Catalan',
        'zh-CN'  => 'Chinese (Simplified)',
        'zh-TW'  => 'Chinese (Traditional)',
        'hr'     => 'Croatian',
        'cs'     => 'Czech',
        'da'     => 'Danish',
        'nl'     => 'Dutch',
        'en-GB'  => 'English (UK)',
        'en-US'  => 'English (US)',
        'et'     => 'Estonian',
        'fil'    => 'Filipino',
        'fi'     => 'Finnish',
        'fr'     => 'French',
        'de'     => 'German',
        'el'     => 'Greek',
        'iw'     => 'Hebrew',
        'hi'     => 'Hindi',
        'hu'     => 'Hungarian',
        'id'     => 'Indonesian',
        'it'     => 'Italian',
        'ja'     => 'Japanese',
        'ko'     => 'Korean',
        'lv'     => 'Latvian',
        'lt'     => 'Lithuanian',
        'ms'     => 'Malay',
        'no'     => 'Norwegian',
        'fa'     => 'Persian',
        'pl'     => 'Polish',
        'pt-BR'  => 'Portuguese (Brazil)',
        'pt-PT'  => 'Portuguese (Portugal)',
        'ro'     => 'Romanian',
        'ru'     => 'Russian',
        'sr'     => 'Serbian',
        'sk'     => 'Slovak',
        'sl'     => 'Slovenian',
        'es'     => 'Spanish',
        'es-419' => 'Spanish (Latin America)',
        'sv'     => 'Swedish',
        'th'     => 'Thai',
        'tr'     => 'Turkish',
        'uk'     => 'Ukrainian',
        'vi'     => 'Vietnamese'

     * Constructor
     * @param Integer $id
     * @param Array $settings
    public function __construct($id, array $settings)
        parent::__construct($id, $settings);
        if (isset($settings['size'])) {
            $this->_size = $settings['size'];
        if (isset($settings['language'])) {
            $this->_language = $settings['language'];
        if (isset($settings['count'])) {
            $this->_count = $settings['count'];

     * Get Service Name
     * @return String
    public function get_name()
        return __('Google +1', 'sharedaddy');

     * Displays preview
     * @return Share_GooglePlusOne
    public function display_preview()
button_style == 'text' || $this->button_style == 'icon-text') { echo $this->get_name(); } else { echo ' '; } ?>
ID) && $post->ID > 0) { $options = array( 'lang' => $this->_language ); echo ''; } return $this; } /** * Shows icon * * @return String */ public function get_display($post) { return ''; } /** * Displays available Service options * * @return Share_GooglePlusOne */ public function display_options() { ?>
_optionsSize[$data['size']])) { $this->_size = $data['size']; } if (isset($data['language']) && isset($this->_optionsLanguage[$data['language']])) { $this->_language = $data['language']; } $this->_count = ($data['count'])?'true':'false'; return $this; } /** * Returns current options * * @var Array */ public function get_options() { return array( 'size' => $this->_size, 'language' => $this->_language, 'count' => $this->_count ); } }

Here you can download this file were you will find a patch for the actual sharedaddy version and the images for the admin panel. You only need to apply patch on wp-content/plugins/sharedaddy/ and copy the images to wp-content/plugins/sharedaddy/images/

25 thoughts on “Google +1 for Sharedaddy

  1. Thanks; this looks like it could be a good modification! I’m about to give it a try and see if it works for me :) I appreciate the organized way that you arranged this, and without the use of an additional plugin.

    – Matthew

  2. Trying the “patch” method. Patch virgin. Downloaded files, extracted… check, check. Uploaded images to sharedaddy image folder, check. Uploaded patch file to /wp-content/plugins/jetpack/modules/sharedaddy, check…and nothing. I’m assuming I need to do something else to activate this patch, or because I’m using sharing via jetpack the path is wrong? Thanks!

    1. Hi

      the patch was made with the standalone sharedaddy plugin, but if you patch from /wp-content/plugins/jetpack/modules it should also work, the patch uses the path “sharedaddy/*”, if you are using somo *nix system it should work with patch -p0 or patch -p1 if you patch from “/wp-content/plugins/jetpack/modules/sharedaddy”

  3. Guess I’m a noob at this too. I moved the files to the proper directory but how do I actually execute the patch?

    1. Hi Dave

      I just uploaded the complete Sharedaddy 0.2.12 plugin with the Google +1 patch included, so that you don’t need to patch, only copy all files over your actual sharedaddy installation.

  4. Hi Polo.
    I had Sharedaddy working fine, but wanted to add Google +1. So I downloaded your version 02.12 and replaced the sharedaddy directory in plugins/jetpack/modules with the directory I downloaded from you, but nothing seems changed. The sharing options available at the bottom of my posts remain unchanged.

    Any thoughts or suggestions?

    1. Have you enabled Google +1 at Admin Panel!? Google +1 is not enabled by default and you must enable it.

      In the admin panel you should see that Google +1 is available with different options.

  5. Tried the self-administered fix, it didn’t take. Tried the patch, no good for my set-up. Finally, uploaded the entire sharedaddy package into the jetpack/modules folder and it worked like a charm!

  6. I just had to say MEGA-THANKS for making my life a little bit more headache free on this fine Sunday. I had been beating it across the keyboard over this for a little while. Brain cells now intact. Thank you!

  7. Great instructions! I simply edited the sources and services php and admin css files, dragged the three icons into the images folder, and added the custom php file to my sharedaddy directory and viola!

  8. Google posted that they recently updated the Google +1 button to improve performance. Any chance we could see an updated version with this incorporated?

    Doesn’t look like Sharedaddy will be adding Google +1 any time soon, haven’t seen any official comment about it.

    1. Hi Christopher,

      I just uploaded Version 1.2 which includes Asynchronous Javascript Loading. I submitted my Code and patches to Sharedaddy but I didn’t got response… ;(

  9. Awesome mod.

    Your “Sharedaddy 0.2.12 with Google +1 – v.1.2” works perfectly for me; just implement it on a client’s site.

    Thanks for your effort!

Leave a Reply to Cladrite Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.