Cagintranet Web Design is a small, yet highly focused design studio built on exceptional work, great relationships and an uncanny knack for the creative.

Wordpress Plugin: WP-SocialCount

WP-SocialCount Wordpress Plugin

WP-SocialCount is a Wordpress plugin that displays the number of adds/saves from within a social network for any particular URL. Since this plugin allows you to specify the URL that you want to pull the data for, it means that you can display any social number for any URL of your choosing. We also attach no style to the data the plugin returns - so you are free to style and use the data in any way you see fit.

Download

Download latest stable version from Wordpress Extend

Installation

  1. Upload wpsocialcount.php to your wp-content/plugins/ folder.
  2. Backup your Wordpress Installation. I don't forsee any problems, but since this install creates a new db table, it's better to be safe than sorry.
  3. Activate the plugin.
  4. Go to Options->WP-SocialCount to set some of the variables for the plugin (not required for basic usage).
  5. Add the template tag shown below into your theme's template files.

Usage

Template tag syntax:

<?php wpsocialcount('social-network', 'data-format', 'url'); ?>
  • social-network: [required] Either 'delicious', 'digg' or 'stumbleupon' for now
  • data-format: [required] The type and format of the data you want
    • data-format options for Del.ico.us
      • link - Echos the link to add the URL to Del.ico.us. Also includes the amount of 'saves' if available.
      • empty - Returns the amount of 'saves' of the specified URL.
    • data-format options for Digg
      • link - Echos the link to digg the URL. Also includes the amount of diggs and comments if available.
      • comments - Returns the amount of 'comments' of the specified URL.
      • diggs - Returns the amount of 'diggs' of the specified URL.
  • url: [required] Use full URL including 'http://'

Examples

Demo Page. Also, visit adClustr. In the top right it shows a customized version of a Del.icio.us link.

Requirements

  • Only tested on Wordpress 2.3.2+, but there is no reason it should not work on any versions of WP 2.0 or above.
  • PHP 5.2.0 or greater for need of JSON support.

FAQ

  • Can it work with other social networks?
    I am in the process of adding more API support as I find the time and code for it.

  • What can I do with this?
    You can create and customize any "Add my post to Del.icio.us", "Stumble This" or "Digg This" badge that your mind can possibly create with CSS. This plugin gives you complete control over the add-to link's appearance.

  • Can I add more than one wpsocialcount function to my templates?
    Yes. As far as I can tell, there is no limit on the number of wpsocialcount tags that can be added to any one theme. However, certain sites will throttle your website's usage of it if it believes you are abusing the API with too many queries in too short of a timeframe. This plugin tries to stop this from happening by caching the data it fetches into a database table and only checking for updates at most once an hour.

Version Changelog

  • Ver 0.4 - March 12th, 2008 - Added support for StumbleUpon. Added administration panel in Wordpress to collect values needed for StumbleUpon usage and other variables. Update: StumbleUpon must have caught on, and this now does not work.
  • Ver 0.3 - Not released to public. Added support for Digg. Also added database caching to try and prevent del.ico.us from throttling users.
  • Ver 0.2 - Not released to public. Changed to pull data from Del.icio.us api. Plugin now requires PHP 5.2.0 because of it's support of JSON.
  • Ver 0.1 - Not released to public. It was a plugin that hacked the Del.icio.us bookmark count from the tagometer badge that Del.icio.us provides.

Credits

These are some of the places I used for help when creating this plugin. I owe a big 'Thank You' to everyone on this list!

  • Joost de Valk - For help with understanding the del.icio.us JSON code
  • SplitBrain - For help in getting around the whole no-StumbleUpon api thing
  • Digg API - Much better documented than any other api so far

7 Reader Comments (reply)

  1. Cool stuff! Going to play with this tonight.

  2. Administrator

    March 13th, 2008

    6:44 am

    @Joost - Thanks! Let me know if you find any bugs. I have been doing a lot of testing, but only on my own sites so far…

  3. Delores said:

    No idea how to get the AuthToken so nothing is pulling up now that I've put the code in the sidebar.

  4. Administrator

    March 23rd, 2008

    5:10 am

    @Delores - The AuthToken is taken from your installation of the SU toolbar. Visit the Splitbrain link in the Options -> WP SocialCount admin section in your wordpress install.

  5. .45 said:

    This was just what I was looking for to offer more customization than feedflare, but I can't get the SU one to work. I got the data from about:config, but it shows nothing on any pages w/ reviews..

    I'm glad to see a Technorati is planned. Would that be favs, or authority?

    Wishlist:
    1.) It would be nice if there were a way to customize the link text rather than having to manually edit the php and replace all occurances, and have to remember to redo this on each update..
    2.) I would also love to be able to show a BlogCatalog rating. I hate those big js badges.(Technorati, BC, etc.)

  6. Administrator

    April 21st, 2008

    4:37 am

    @.45 - Glad it is what you were looking for!

    A few things:

    1. I thought about making the link text customizable, but the problem was that introduced way too many things (variables) that had to be accounted for. You should however, be able to build your own link with combining the numbers, link url etc though html though.

    2. SU stopped working. I meant to update this page with this info, but the thing is, SU doesn't have an API — so it was a hack job anyway.

    3. The next release should be much cleaner code and will include YouTube. Technorati is on the list, and I will definitely look into BlogCatalog for you…

  7. .45 said:

    Thanks for the response. I'm using it now for the post pages and want to work it in the sidebar (hardcoded for HP) when I have a chance to fix the CSS. No worries on SU. Was just making sure I wasn't crazy. I actually read the SplitBrain post before coming here for a less involved solution.

    I think the counts are helpful for a little nudge, as long as they're not in big, ugly badges that distract from content.

    And thanks on BC. I did see that have an API that shows the field in XML. Again though, just a WL suggestion.

    I also want to try hardcoding ShareThis tracking (since I broke the most important few out of their widget). Luckily, you have a link encoding routine I can use to clean the format!

Post a Comment (rss)





Pittsburgh Web Design - Cagintranet Web Design