topical media & game development

talk show tell print

mashup-delicious-08-delicious-tag-links.php / php



  <?php
  /*
  Plugin Name: Del.icio.us Category Links
  Plugin URI: http://wordpress.org/#
  Description: Takes your post categories and creates a list of links to matching tag pages at del.icio.us.
  Author: Your Name
  Version: 1.0
  Author URI: http://www.yourwebsite.com/
  */
  
  //your del.icio.us username
  delicious_username = 'username';
  
  //append to the post text the links to del.icio.us
  function add_links(post_text) {
      global delicious_username;
      //setup the delicious_links variable
      delicious_links = "<p class=\"meta\">More at my del.icio.us: ";
      //append links for each category
      foreach(get_the_category() as cat) { 
          delicious_links .= "<a href=\"http://del.icio.us/$delicious_username/$cat->cat_name\">cat->cat_name</a> "; 
      }
      delicious_links .= "</p>";
      //return post text with delicious_links added
      return post_text.delicious_links;
  }
  
  //action hook to handle post content
  add_action('the_content', 'add_links');
  
  ?>


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.