WordPress plug-in: Snipplr Snippets

Recently I blogged about the fact that Snipplr was under new management!, and what great news that is. You can see the changes being made already, fingers crossed they manage to nail the spam issue.

Back when Snipplr was young, Tyler Hall wrote a WordPress plug-in for Snipplr that allowed you to embed your snippets directly into your posts. What a great idea; unfortunately it hasn’t been updated since 2006 and much has changed in the world of WordPress. Enabling the plug-in in it’s current state is a little flakey; so I’ve decided to update it for WordPress 3.0+.

The plug-in is called ‘Snipplr Snippets’ and is available to download from the WordPress plug-in repository. I’ve used many of the functions that were in the old plug-in so it isn’t a complete rewrite but much of the structure has changed (big thank you to Marcin Dominas helped with a couple of issues i was having at first).

View of the snippler snippets side bar.

Snipplr Snippets sidebar widget in action.

The administrator area has been updated and there are a couple of new features available which hopefully are self explanatory. I’ve also updated to the latest version of GeSHi for the syntax highlighting, if you don’t like the look a feel of the outputted code simply disable the plug-in CSS in the site header (admin panel), copy to your style.css and modify as needed. For the plug-in to work you will need a Snipplr account and an API key (available from the settings page).

Once you’ve installed the plug-in and enabled it, it’s dead simple to include a snippet into your blog post like so:

//Remove the spaces inside the brackets.
[ snippet id=## ]

Where the ## is the ID of the snippet you wish to include in the post (you can get this from the snippet URL). The code below is pulling in a snippet directly from Snipplr using the plug-in:

[snippet id=26403]

I’ve tested the plug-in and it seems to work fine, there was a warning from the CodeColorer plug-in because it also uses GeSHi for syntax highlighting but I haven’t noticed anything break because of it. If it does please let me know and I’ll fix it. If you have any suggestions / bugs leave a comment and I’ll see what look into implementing / fixing them. Download here.

rob on August 9 10 / 220 Permalink

the plugin says my api key is not correct but I am copying and pasting directly from snipplr.com. Any clues? Would love to use this plugin!

Matt on August 9 10 / 220 Permalink

Hi Rob,

Would you mind sending over the broken API key via the contact form. You could also try resetting the API key to a new value at the bottom of the settings page. I’ll take a look into why yours isn’t working, as it’s the first time it’s been reported. Very odd.

Chris on November 2 10 / 305 Permalink

My API key is also showing up as invalid in the WP plugin. I will send it to you via the contact form.

Matt on November 2 10 / 305 Permalink

Hi Chris,
I just tried your API key and it’s also returning an invalid key error for me too. Since the plug-in simply returns a message from the server it doesn’t seem to the a plug-in issue. What you can do though is reset your Snipplr API key (under settings –> very bottom of the page). That will give you a new API key that you can then try with the plug-in.

It may be that Snipplr have changed the way their API keys are generated recently, and it’s returning an error on an old version. Just a guess…

Hope that helps!

Leave a Comment

Your email will not be published. Required fields are marked *.