WP_Folksonomy

WP_Folksonomy Screenshot

Aziz of metaBLOG suggests that the new tags in WordPress 2.3 can be used to create a “folksonomy” on WordPress blogs. For those not in the know (including me until a couple days ago), a folksonomy is is the practice and method of collaboratively creating and managing tags to annotate and categorize content according to Wikipedia. Basically it’s letting normal people (versus say artificial intelligence or an administrator) help describe things. For example, adding a tag on flickr or using del.icio.us.

So since WordPress doesn’t currently have anything like a public “Add a Tag” and I haven’t coded a WordPress plugin recently (although I did upgrade WP_MonsterID if anyone is using it), I thought I would code up a quick plugin to see how it works. So here is WP_Folksonomy. It’s fairly basic at the moment but I’d like to get it out there to see if it’s useful and if anyone is interested in it.

Since it uses WordPress’s tagging features WP it’s only going to be compatible with WordPress 2.3 and up.

Features

  • Allow readers (or registered users) to add tags to posts
  • Choose between immediately displaying tags and waiting for admin approval first
  • Delete user submitted tags
  • Delete or approve all tags by user/IP address
  • RSS feed for monitoring added tags
  • Javascript autocompletion for increased tag standardization
  • Limit tags per time limit to discourage bots

Current Version:

WP_Folksonomy v0.8

Installation instructions:

Unzip wp_folksonomy.zip. Upload wp_folksonomy.php to wp-content/plugins/ and activate in the Plugin Control Panel. Now the slightly difficult part. Unfortunately there is no automatic hook near the tags in WordPress so you’ll have to make a minor change to one of your theme files. We’re aiming create a tiny form to allow your users to add tags. Many themes will be using the wordpress <?php the_tags('some','options');?> to list the tags. Try to find this function or a similar tag listing function. It’s often either in wp-content/themes/CurrenTheme/index.php or wp-content/themes/CurrenTheme/single.php. Once you find it add the following code <?php if(function_exists('wp_folksonomy_add_form')) wp_folksonomy_add_form();?> immediately after it. For example in the default WordPress theme, it looks like:

<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
<?php if(function_exists('wp_folksonomy_add_form')) wp_folksonomy_add_form();?>

Sorry it’s not more automatic but if you’re having any trouble figuring out where to put it feel free to ask in the comments (make sure to tell me which theme you’re using). You can view and delete tags from the Folksonomy control panel in Settings or a little widget on the dashboard an RSS feed.

Change Log:

  • v0.8 9-22-2008:
    • Put in a time limit for max tags per time to discourage bots
  • v0.71 7-5-2008:
    • Fixed deleting problem with term_id vs term_taxonomy_id
  • v0.62 5-28-2008:
    • Added caching compatibility
  • v0.61 5-28-2008:
    • Fixed invalid HTML
  • v0.6 5-27-2008:
    • Fixed missing $wpdb->prefix causing missing table
    • Fixed installation directions (extra “function ”)
    • Added javascript tag completion
    • Fixed paging on tag display
    • Removed dashboard widget
    • Added an RSS feed for monitoring added tags
  • v0.5 12-21-2007:
    • Fixed undeleteable tags when tag had been created, deleted, created
    • Fixed added tag not displaying on submitter’s page until after reload in themes with a late call to wp_head()
  • v0.4 12-19-2007:
    • Approve all tags by user/IP
    • Delete all tags by user/IP
    • Tags added within post page (no longer needs $_GET variables)
  • v0.3 12-17-2007:
    • Limit tags to 25 characters
    • Only allows users who can edit posts to approve/delete tags
    • Fixed option update bug
    • When Registered Users options set, only displays tag add form for registered users
  • v0.21 12-15-2007:
    • Fixed overlap between tag add and comment add $_POST variables
  • v0.2 12-15-2007:
    • Added Control Panel
    • Added Subscribers Only and Authorize Tags options
    • Tracks submitted tags
    • Added Delete and Accept Tag actions
  • v0.1 12-14-2007:
    • A rough public tag adder