Adding Sites to Sociable

While Sociable comes with a pretty large set of sites, there are always people that want to add their own. While this is pretty easy to do, you’d have to update the plugin every time it’s updated, which is quite often, so that’s not really a workable solution.

Today, I’ve fixed that. I’ve just submitted version 3.4 to wordpress.org, this version makes it possible to add sites to Sociable from either a plugin or from your theme.

You’d simply have to do the following:

function sociable_add_sites( $known_sites ) {
  $known_sites['Joost'] = array(
    'favicon' => 'http://cdn.yoast.com/images/joost.jpg',
    'url' => 'http://yoast.com/submit-to-yoast',
    'description' => 'What else would you do?'
  );
  return $known_sites;
}
add_filter('sociable_known_sites','sociable_add_sites',10,1);

As you can see you can easily add your own sites now. The favicon URL can be both an absolute URL to the file, or just a filename. If it’s just a filename Sociable will look for it in the image directory you’ve defined in the backend.

You could also use this functionality to change the icon for a certain site, just add the following to the code above (before the return statement):

$known_sites['del.icio.us']['favicon'] = 'http://cdn.yoast.com/images/joost.jpg';

As said, you can either add this code into a plugin, or put it into your themes functions.php file. After doing that, the site will become available for you to pick in the Sociable admin panel.

Update: version 3.4.1 also fixes the Sphinn submit button, to work with the new version of Sphinn.

Tags:


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

54 Responses

  1. SimonBy Simon on 16 July, 2009

    Great update Yoast! Makes it easy to add lokal services now.

  2. Jermaine YoungBy Jermaine Young on 16 July, 2009

    I may just use this one day. Thank you.

  3. Blogs d'écoleBy Blogs d'école on 16 July, 2009

    Hello,

    Would be great to have the same for the customs images. I’ve changed the images to bigger ones, and I have to update that every time the plugin is updated … :(

    • Joost de ValkBy Joost de Valk on 16 July, 2009

      What would you need to change then? You can simply specify an image dir right? I use bigger images myself and never have to change a thing…

  4. Karl FoxleyBy Karl Foxley on 16 July, 2009

    This is a very welcome addition… thanks for this!

    Karl

  5. britaBy brita on 16 July, 2009

    Hi Joost,

    I just upgraded to 3.4.1, and when I tried to update my settings, got this message: Fatal error: Call to undefined function: screen_icon() in /home/jmainehu/public_html/podcast/wp-content/plugins/sociable/sociable.php on line 982

    Sorry not to post this on WordPress user forums…

    • Joost de ValkBy Joost de Valk on 16 July, 2009

      Update your WordPress. Screen_icon was introduced in 2.7, 2.6 is insecure, so: update.

  6. Evan MullinsBy Evan Mullins on 16 July, 2009

    Awesome idea! I was just thinking about digging into the source to add sites to my list! You’ve made it too easy not to customize it now! I’d request a special settings section in the sociable settings page with a space where I could type php to add sites and they would be saved even when updating the plugin! But I’m stoked, I’ve already added a site to my sociable list!

  7. teknolojiBy teknoloji on 16 July, 2009

    thanks for this abdurrahman

  8. JordanBy Jordan on 16 July, 2009

    Thanks for the great site, Yoast. While we’re on the subject of Sociable, what kind of response have you had with it? Does it really seem to encourage people to share your links on social networks and ultimately drive traffic? I’ve been considering using it for some time on my own site, but I don’t think I’ve ever actually used the links anywhere else around the web. Maybe that’s just me, though.

    • Joost de ValkBy Joost de Valk on 17 July, 2009

      it works well, but don’t take my word for it, test it!

  9. RoyBy Roy on 16 July, 2009

    Good idea, i’m off to try and figure out how to use custom images…

  10. reesanBy reesan on 17 July, 2009

    Hi Yoast, love your plugin and was excited to read this article as I was forever re-adding JapanSoc.com.

    However, this is probably my complete ignorance so I apologise in advance, I added the code above to my functions.php as per below:


    function sociable_add_sites( $known_sites ) {
    $known_sites['JapanSoc'] = array(
    ‘favicon’ => ‘japansoc.ico’,
    ‘url’ => ‘http://www.japansoc.com/submit.php?url=PERMALINK&title=TITLE’,
    ‘description’ => ‘JapanSoc’
    );
    return $known_sites;
    }
    add_filter(‘sociable_known_sites’,’sociable_add_sites’,10,1);

    But this gives me the following fatal error:


    Fatal error: Call to undefined function add_filter() in /******/wp-includes/functions.php on line 3357

    When I strip out the add_filter I have no fatal error but no ‘known sites’ functionality either.

    Like I said, this is all probably my foolishness… does the add_filter command have to go in a different location than functions.php?

    • reesanBy reesan on 17 July, 2009

      sorry to disturb. i knew that it would my my own stupidity. i placed the code in the wrong functions.php! d’oh!

      all resolved now. thanks for listening. :-)

      • Joost de ValkBy Joost de Valk on 17 July, 2009

        Glad you’ve got it working!

  11. otoharleyBy otoharley on 17 July, 2009

    i love sociable plugin. This plugin is very great. Many thanks

  12. detBy det on 17 July, 2009

    it worked as a charm!!!

    thanks for your GREAT job!!

  13. Blogging ContestBy Blogging Contest on 18 July, 2009

    Great update Yoast! Thanks for sharing it…

    Best,
    Indo Contest

  14. GhufronBy Ghufron on 19 July, 2009

    Nice info! I will try the code above on my theme. I using Arthemia theme. Thanks!

  15. boomintBy boomint on 20 July, 2009

    Great plugin Yoast! Thanks for sharing to us..

  16. Navjot SinghBy Navjot Singh on 20 July, 2009

    I am trying to add multiple sites by using this function in the form:

    function insociable_sites( $known_sites ) {
    $known_sites = array(

    ‘Social1′ => Array(
    ‘favicon’ => ‘image1.png’,
    ‘url’ => ‘http://www.social1.com/submit’,
    ),

    ‘Social2′ => Array(
    ‘favicon’ => ‘image2.png’,
    ‘url’ => ‘http://www.social2.com/submit’,
    ),
    );

    It does adds these sites but removes all others provided by default. It just shows these two and the remaining default selected sites. All other inactive sites are disabled. Infact the images shown by the default selected are also not shown.

    How to fix this?

    • Navjot SinghBy Navjot Singh on 20 July, 2009

      OK fixed it. Got the basics of PHP wrong. :lol:

  17. Navjot SinghBy Navjot Singh on 20 July, 2009

    I have just released a Indian Version of Sociable at http://nspeaks.com/671/indian-sociable-wordpress-plugin-released/ – It uses the above function. Thanks Joost for this.

  18. micro komputerBy micro komputer on 22 July, 2009

    This is a very welcome addition… thanks for this!

    best regard

  19. JoelleBy Joelle on 22 July, 2009

    I love the Sociable plugin as well and thanks for the tips on how to add more sites to the list. However, I was curious if this issue had been addressed? http://wordpress.org/support/topic/288487?replies=13

    I’m using WP 2.8.2 and Sociable 3.4.1 – but it was having this challenge with 2.7.1 and 2.8.1 as well.

    Thank you!

  20. ZimBy Zim on 24 July, 2009

    Great! I was just going to suggest you the site “Chuenga”. Good information :)

  21. alfonBy alfon on 27 July, 2009

    wow a good idea & thanks for sharing :)

  22. juustBy juust on 27 July, 2009

    Joost, are you planning on adding a store for accountnames and passwords to Sociable ? It would give the plugin a lot more potential uses.

  23. WildcatDigitalBy WildcatDigital on 27 July, 2009

    I was JUST wondering if adding custom sites would be possible. Thank you!!

  24. Happy HotelierBy Happy Hotelier on 29 July, 2009

    Hi Yoast
    After having tried the tweetmeme plugin and finding out it gave too many errors, I now see your sociable plugin gives too many errors when validating my sites and deactivated it.

  25. musabBy musab on 29 July, 2009

    thanks for a great job

  26. Adi SabarwalBy Adi Sabarwal on 30 July, 2009

    Thanks for the plugins. I’ve been reading on your site for the last 5 hours and implementing all the advice/plugins onto my new blog before I ‘officially’ open it.

  27. KaitlinBy Kaitlin on 31 July, 2009

    I assume this means that it will now be possible, for example, to add functionality that is in other plugins (for example, WP-Email). My PHP is a bit soft, though, so I’ll have to play around to figure out how to make the URL pull the WP-Email URL.

  28. Paul LearBy Paul Lear on 3 August, 2009

    I’ve not installed sociable on my blog yet, I guess I better get a move on & do it. :D

    Great post, great info.

    Thanks,

    Paul.

  29. N3RIBy N3RI on 7 August, 2009

    WOW! Thats my idea, cool! Thanks!
    http://wordpress.org/support/topic/288985#post-1134697

    But, I have a question. If I put this php code on funtions.php what happens when they update wordpress and they have a new funtions.php file?

    Isn’t it the same problem than before? I asked this feature because every time you upgrade the sociable plugin, it overwrite the edited sociable.php file and my site disappears. Now, every time wordpress upgrade the functions.php file it will overwrite the edited file?
    I think the ideal solution is one that you have not to edit a wordpress file, like a second sociable.php file, something like “sociable_extra_sites.php”

    Sorry if I’m wrong. Your plugin is so cool and useful.

    • KaitlinBy Kaitlin on 7 August, 2009

      functions.,php doesn’t get replaced when WordPress is upgraded/updated. Functions.php is a part of your theme, and not part of the WordPress core that is being upgraded. Even if your theme is updated, *most* theme authors aren’t updating the functions.php file because the whole idea is to have things that the user defines that don’t get messed up when updating WordPress or the theme.

  30. LouiseBy Louise on 9 August, 2009

    I am a newbie. When you talk about adding codes and things – does that also apply if you use the wordpress.org uploads. I just upgraded and am wondering if that takes care of it or if I need to do something else.

    Louise

  31. VeronicaBy Veronica on 14 August, 2009

    Hi there,

    Just did an upgrade of sociable, but nothing seems to work right now…
    Checked settings & found a whole list of notes such as this:-
    “Warning: Missing argument 2 for checked(), called in /home/patron/public_html/blog/wp-content/plugins/sociable/sociable.php on line 1065 and defined in /home/patron/public_html/blog/wp-admin/includes/template.php on line 363
    checked=”checked” /> Front page of the blog”

    Any advice you can give?

    • JulieBy Julie on 16 August, 2009

      Hi

      I am experiencing the same issue as Veronica – same error message. The wordpress version i am using is 2.7 – is this the problem? Is the new version of sociable unstable when used with wordpreass 2.7.
      If this is not the case could you please advise what is the problem and how to rectify
      Thanks

  32. MartijnBy Martijn on 17 August, 2009

    Just had this problem last night as I was trying to add some Taiwanese sites to Sociable.

    I had found some sites and Icons in this post:

    http://wordpress.org/support/topic/228080

    Now I will just rework my theme instead.

  33. BayrakBy Bayrak on 18 August, 2009

    Thank you plugin

  34. rawloaderBy rawloader on 20 August, 2009

    Thanks a lot, it very helpful.

  35. GerardBy Gerard on 20 August, 2009

    Hi Joost, I modified Sociable 3.4.4 to add ShareThis as an option. This is for a site that wants the most popular social bookmarking options clearly displayed in an uncluttered way, with ShareThis taking care of most others. If you’re interested in including this in a future version I can send you the code. It does complicate things a bit: a ShareThis publisher ID is needed (with a field in the admin area to enter it) and JavaScript is required. A moderate amount of special case code to make it work.

  36. Teknoloji haberleriBy Teknoloji haberleri on 20 August, 2009

    thank you plugin admin

  37. HeshamBy Hesham on 29 August, 2009

    This is great news, I was contacting you before for this reason, but I thought it will be hard work for you with all these social websites coming all the time to life!

    Thanks for the good idea, and your support!

  38. KatyusyaBy Katyusya on 2 September, 2009

    Thanks you for your support.

  39. discount web designBy discount web design on 3 September, 2009

    Thanks for such excellent post. Really informative blog. Keep the good work here and i wish you all the best and success.

  40. Gilgamesh13By Gilgamesh13 on 8 September, 2009

    Hi !

    I just noted that when I activate your Sociable plugin Version 3.4.4, it runs well, but the dashboard disappeared (WordPress 2.8.4 – Arthemia Premium Theme).

    Thanks !

Trackbacks