Singpolyma

Technical Blog

FreshTags for WordPress

Posted on

The FreshTags system is more than just categories for Blogger. With the tag-passing features it adds a social aspect to blog browsing. Not everyone runs on Blogger, and some of us are lucky enough to run on blogging systems that support categories natively. The other FreshTags features would be and can be immensely useful to these people as well. So, in a move to push FreshTags beyond Blogger and beyond del.icio.us I have created a FreshTags plugin for WordPress.

Update: Version 0.11 has been released. Some minor bugs have been fixed and loading captured tags into the search box is now optional. To load the searchbox you must add this code to your template: <?php freshtags_load_searchbox(); ?>

Features

  • Detects tags passed directly via ?tags, ?tag, or ?cat
  • Detects tags from the referer URL, all the same formats as the original FreshTags are supported
  • Detects the tag of the current category page or the first tag on the current post, if applicable
  • Supports tag intersections
  • Displays n matching posts from detected tag(s) in the sidebar
  • Supports either list or drop form of tags in the sidebar, highlighting selected tag(s)
  • Rewrites post links when tags are selected to enable tag-passing from the blog
  • Generates JSON(P) feeds for use in peek-a-boo sidebar headlines by other blogs

Implementing
To implement this plugin on your WordPress blog:

  1. Download the plugin
  2. Unpack the file and upload ‘freshtags.php’ to your /wp-content/plugins/ directory on your blog
  3. Go to your WordPress dashboard and the plugins screen to activate the plugin
  4. Edit your template and replace the code that outputs the category list in your sidebar with:
    <?php echo freshtags_taglist();
           echo freshtags_postlist(); ?>

    To customise the display you can pass ‘drop’ to freshtags_taglist to get a drop-down list of tags. You can pass two parameters to freshtags_postlist, the first is the maximum number of posts to display (default: 10), the second is a string to output as a header for the list of matching posts (replacing %tags% with the detected tags, default none).

Other
I have updated my version of FreshTags to support getting peek-a-boo titles from blogs using this WordPress plugin. Just call load_otherblog_titles(‘wordpress’,’blog url‘,”,’feed url (optional)‘,’id of element to put results in‘); after the normal FreshTags data has loaded.

8 Responses

Trev

Trying it out…you’re missing the ? in the “<php” of your example, though 😛

Johan Sundström

Maybe you should rewrite your comment system to write out the whole comment form by means of javascript, to deter bots from finding it. (At least I believe that might rid you of much of the problem even if the receive comments page is technically still wide open.)

Singpolyma

I don’t really get much comment SPAM so I don’t tend to worry about it… but that’s a good idea since the radio-button section already relies on JavaScript anyway… I’ll look into it 🙂

Trev

Hey, just a suggestion that you should put the straight php up for download, since it’s a tiny file, and not everyone knows what to do with a gzipped tarball. Or is there another reason?

Singpolyma

You cannot download a PHP file straight because the server tries to render it — I could just add a different extension or something, but thought that might be confusing. If it becomes a problem I’ll upload a .zip as well as a .tar.gz 🙂

Trev

Oh yes, that’s right, you’re hosting it on AW. I hadn’t thought of that, and it just seemed silly to compress a little text file!
Makes sense now.

Leave a Response