Simple Social Bookmarks
Simple Social Bookmarks displays icons for various popular social bookmarks sites on your posts and/or pages.
Download
Download Simple Social Bookmarks (v1.5, 19/01/2010)
Changelog
Version 1.0
- Initial release
Version 1.1
- Now XHTML compliant!
Version 1.2
- Fixed issue with ampersands (and probably other characters) in the blog title causing linking issues
- Added su.pr as another URL shortening service
Version 1.3
- Updated default icons to a set kindly provided by komodomedia.com (With the exception of the AddToAny and Ping.FM icons)
- Added AddToAny, Ping.fm, Google Bookmarks, Google Reader and email to the list of providers. By default these will be turned off so as to not to suddenly appear on existing installs and cause problems!
- Further improvement to blog title issues
- Removed URL shortening on all services with the exception of Twitter, as it was not required and may have even have caused some issues (such as some services not being able to get hold of thumbnails and general page content).
- Now using Simple URL Shortener plugin to provide URL shortening
- Caching of short URLs now takes place providing large performance improvements
- NOFOLLOW and TARGET parameters added
- Compressed default icons
Version 1.4
- Removed caching, as this is now handled by Simple URL Shortener. Please ensure you update to the latest version of this plugin to ensure that caching continues to work – once you know it does, the cache folder for this plugin can be removed.
- Added additional parameter – cache=
- Tidied code and updated shared functions
Version 1.5
- Use different encoding for email links
- Added Technorati to the list of providers. By default this will be turned off (including using the default=on option) so as to not to suddenly appear on existing installs.
Installation
- Upload the entire
simple-social-bookmarksfolder to yourwp-content/plugins/directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- There is no options screen.
Configuration
From version 1.3 you must now install the Simple URL Shortener plugin for the URL shortening to work in this plugin
From version 1.4 the caching of short URLs is now performed by Simple URL Shortener – please ensure you have the latest version to ensure that this works
The code for Simple Social Bookmarks should be added to the bottom of appropriate post/page templates within your theme (and in the case of posts, within the loop).
Here is an example…
<?php echo simple_social_bookmarks('','Currently reading a blog post titled %title% - %url%','padding-left: 5px; padding-right: 5px','service=is.gd&iconfolder=24x24'); ?>
There are 3 parameters in total that require passing.
The first parameter is the URL that you wish the Social Bookmarks to respond to. If left blank (and this is probably the default for most people) it will use the URL of the current post/page.
The second parameter is the text that is passed to Twitter. If you don’t specify anything then it will take you to your Twitter account and pre-fill in the status with “I’m currently reading xxx”, where xxx will be the URLaddress of the page/post that you just came from.
If, however, you’d like to define your own Twitter text, then you simply pass this as the second parameter. %url% must be specified within the sentence, as this specifies where you want the URL to go. You can also the tag %title%, which will show the post/page title in the Twitter text.
So, in the example above, it will set the status to “Currently reading a blog post titled yyy – xxx”, where xxx is the URL and yyy is the title.
The third parameter is a style definition which applies to the bookmark icons. In the example above adds a 5 pixel padding to the left and right of each icon.
Finally, the fourth parameter can contain a number of sub-parameters, all of which should be divided by an ampersand. These sub-parameters are as follows…
default= – This should be on or off and defines whether ALL the social bookmarks should display by default or not. Not specifying this sub-parameter will cause all to be displayed.
service= – This allows you to specify a URL shortening service to be used with the URLs. See the documentation for Simple URL Shortener for a complete list of those that are available.
iconfolder= – By default, a set of icons in the plugin’s folder will be used. If, however, you’d like to use your own icons then you will need to add a sub-folder and then use this parameter to specify the sub-folders name. In the above example, I am specifying a sub-folder named 24x24.
nofollow= – If specified as YES this will turn on the NOFOLLOW attribute for the links. By default, this is switched off.
target= – Allows you to override the standard TARGET of _BLANK.
cache= – Specify as NO to turn off the caching of short URLs.
There are also sub-parameters for EACH of the social bookmarking services, allowing you to specify for each whether they should be turned on or off. So, for example, to turn Digg off, you would specify digg=off.
So, as a further example, if you ONLY wanted the Delicious and Digg bookmarks to appear, it would be best to specify the default as off and then turn Delicious and Digg on individually, like so...
<?php echo simple_social_bookmarks('','','','default=off&delicious=on&digg=on'); ?>
The full list of social bookmark services are as follows…
- AddToAny#
- Delicious
- Digg
- Email#
- Google Bookmarks#
- Google Reader#
- MySpace
- Ping.FM#
- StumbleUpon
- Technorati
# These services will not appear by default, as they were added later. This includes when using the default=on parameter.
Here is a further version of the original example, but this time with a check to confirm that they plugin is active…
<?php if (function_exists('simple_social_bookmarks')) : ?>
<?php echo simple_social_bookmarks('','Currently reading a blog post titled %title% - %url%','padding-left: 5px; padding-right: 5px','service=is.gd&iconfolder=24x24'); ?>
<?php endif; ?>
It’s also possible to add the Social Bookmarks to your WordPress feed. Open up your functions.php file within your theme folder and add the following code…
<?php
function insertRss($content) {
if ( (is_feed())&&(function_exists('simple_social_bookmarks')) ) {
$content = $content."<p>".simple_social_bookmarks('','Currently reading a blog post titled %title% - %url%','padding-left: 2px; padding-right: 2px','service=is.gd&iconfolder=16x16')."</p>";
}
return $content;
}
add_filter('the_content', 'insertRss');
?>
Obviously, you will need to modify the parameters that are passed to the Simple Social Bookmarks plugin, to make it appropriate for yourself. In the above example you may notice that I’m using smaller icons with a small padded space between them.
You haven’t included my favourite Social Bookmarking service!
I didn’t want to maintain a large number of, mainly, smaller and lesser used services. I have therefore only included those that I believe are the most popular.
If, however, you think I have missed one of great importance, please get in contact with me and plead your case!
Comment/Reviews
“After trying all the plugins on bookmarks I could find! THIS ONE is my absolute favorite! Easy, clean and good looking”
Known Issues
“cannot yet handle MBCS in html_entity_decode”
This is a known bug in PHP 4. Please read this post for further details and possible workarounds.
Problems/Queries
Please report any problems, or suggestions for enhancements, to me either via my contact form or by commenting on the appropriate entries on my blog.
Updates
Updates to this and any other of my WordPress plugins will be published on this blog.
Subscribe to my WordPress category feed.


















Artiss.co.uk is checked by
I would use it on my site, but it’s not valid xhtml, please fix that and I will be more than happy to use it.
Done! Version 1.1 is now available…. (grumble, grumble) I normally make a habit of checking the XHTML too. Thanks for letting me know!
Thank you very much David, I’ll be sure to check out more of your plugins!
After trying all the plugins on bookmarks I could find!
THIS ONE is my absolute favorite! Easy, clean and good looking
I’d love to use it but I can’t figure out where in my single post template it goes. I keep getting errors no matter where I put it.
It’s hard to give an answer as different themes have their templates organised different. If you want to contact me via the contact form, attaching the relevant template file, I’ll take a look and let you know.
I am thrilled this plugin exists but for some reason the icons are not showing. I just get text links. I’m not sure what I’m doing wrong. All I did was upload the plugin and activate it and then drop in the first simple strip of code. help.
In the plugin folder the icons should be in there as well – ensure they are. Also, the code you used to use it – does it have a
iconfolder=parameter in it? If so, this is overriding the default folder to elsewhere – remove it and it will use the default icon set.I figured out the problem and thought I would give a shout out for anyone that ran across the same issue. If you want the icons to show verses just text links you will still need to create a new folder within the simple-social-bookmarks folder labeled 24×24 and place the default icons in it. These of course can be swapped out for custom icons but I feel the default ones are very nice.
I saw you message after I added the latest. Perhaps I did it wrong but I got the desired results. Thanks for you help David!
Thank u! This is a great plugin, that worked right off the bat. Thx Naomi for the tip about the icon folder, otherwise I might have gotten into problems.
Thanks for such a great plugin. Just installed Simple Social Bookmarks and Simple URL Shortener on WordPress 2.9 and I think they’re great!
I like this plugin the most because:
It doesn’t require yet another javascript
It doesn’t have an external stylesheet just for the plugin
Ran into a snag with Simple URL Shortener on V2.9 though, the plugin didn’t create a cache folder, which caused an error. Went into the plugin folder and added one and all is well.
Thanks for everything
Ok, yes, that’s my fault – I forgot to include the empty cache folder in the plugin download package. I’ve now included it.
Hi, I like the simple social bookmarks plugin, but I can’t get the simple url shortener to work. I have uploaded it in the right directory, changed the cache to CMOD777, but my URL’s don’t get shortened. After some testing it seems like it is not recognised that simple url shortener is activen (though my plugin panel says it is). Can you help me out?
And I have another question. If I add e-mail to the social bookmarks the spaces are replaced by +, so it reads something like “I+have+read+something+on:URL” With Twitter it works perfect.
After further discussion with Bas, and an exchange of emails, I am about to release a new version of Simple Social Bookmarks with an improved encoding method for email links.
I have also found an issue with Simple URL Shortener (it doesn’t work if you have PHP 4!) and will release a new version of that too!
Thanks to Bas for helping me get to the bottom of these.
David, it was a pleasure to help you. I really appreciate all the effords you have made to make it work for me. And all the things you are doing to keep this great plugin doing a very good job. So thanks to you!
David,
I love how simple & fast the plugin is. However, I’d like to include it in my footer (outside of the loop) rather than at the end of every post. This works fine on posts & pages, but not so well on the home page & category archives, etc. In those locations the URL and title are of the last post referenced, not of the homepage or archive themselves. Any suggestions?
Yes. The first parameter you pass is, if required, the URL that you want it to use. If using it outside of the loop to represent, for example, the entire site, simply specify your site URL as this first parameter.
David,
It was a bit more complicateds, but in case you’re interested here’s what I did to make it work. First, I checked if I was on the home page or a category page, in which case I set the url & title by adding this just above your //Check URL:
if (is_category()){
$cat=get_query_var(‘cat’);
$yourcat=get_category($cat);
$url = get_category_link( $yourcat );
$title = single_cat_title(“”, false);
}
if (is_home()){
$url = get_bloginfo( url );
$title = get_bloginfo( name );
}
Then I modified your setting the URL and title to only happen if it’s a single post:
if (is_single()){$title=urlencode(html_entity_decode(get_the_title($post->ID),ENT_QUOTES,’UTF-8′));}
I got some of the info to make this work from http://www.bestwpthemez.com/wordpress/code-to-get-current-category-slug-in-wordpress-blog-1434/
I might need to do a little more cleaning up, but it seems to work for me.
hi, this is a great plugin, but i need to include the email function and icon – the instructions doesn’t detail how except to say it won’t appear by default. can you please let me know?
thanks!
When specifying the sub-parameters, simply add email=on (with an ampersand before it if tagging on the end of existing ones). For example…
<?php echo simple_social_bookmarks('','','','email=on'); ?>Hi David,
Thanks for getting back so quickly. I have tried that and it didn’t work.
Here’s my bit of code:
And this is the page that I’m working on.
http://www.grassrootsjourneys.com/explore/south-america/ecuador/akangau-tours/
I can see that default icon are up, I just want to add the email as well. I haven’t altered anything else but for the above code.
Thanks!
As you can see, you code has gone from the comments (I don’t allow embedding within the comments). I’ve attempted to email you but the email address you’ve supplied isn’t working. Please contact me via my contact form, sending me the code in question. Thanks.