DotNetKicks "Kick It" Counter Plugin for Windows Live Writer
Some people write pretty quality .NET-related blog posts every time. You know, stuff worth posting and kicking on DotNetKicks. Then there’s people, like me, who obscure the occasional “good” post with a mountain of crap. If you don’t know what DotNetKicks is, I encourage you to check it out. It’s a great community-edited feed of .NET-related posts, with minimal “noise”.
I found myself wanting to add a “kick it” counter on some of my posts to enable people to easily kick them (via their blog reader, for example), but not on every post. I mean, who wants to kick a post about contacting me? Not even I do!
Here would be the process with what I’ve currently got:
- Write a kick-worthy post.
- Publish the post.
- Get the permalink for the post in question.
- Submit the post on DotNetKicks.com, and copy the HTML for the “kick it” counter.
- Add the HTML to my just-posted post, and re-publish the updated version.
Way too manual. So after a little research and a little coding today, here’s my new process:
- Write a kick-worthy post.
- Click
from Windows Live Writer.
- Publish.
The Problem
It’s simple, really: adding the “kick it” counter requires knowing the permalink of a particular post. That prevents me from inserting it for real at creation time, because the permalink isn’t known until the post is published. I could just add the “kick it” code to my wordpress template, but as I originally mentioned, I don’t want it on every post – just some. (Yes, I realize I’m overcomplicating things – it’s my blog though.
)
The Solution
Unfortunately any solution, including mine, will require some cooperation between Windows Live Writer and the blogging platform. Mine includes a Windows Live Writer plugin and a Wordpress plugin. The Windows Live Writer plugin adds a placeholder (“<!–dotnetkickit–>”) to the post, and the Wordpress plugin transforms the placeholder into the “kick it” image/link HTML at render time.
Windows Live Writer Plugin
The Windows Live Writer plugin adds an “Insert Kick It Counter…” link in the list of “insertable items.![]()
Click it and, like any other inserted item, a default “kick it” image is added.
This image is static, and is just for layout purposes only – Windows Live Writer allows plugins to insert different “editor” versus “published” HTML. When editing, I insert a static image so you can get the look-and-feel, and when published, only the “<!–dotnetkickit–>” placeholder gets inserted. Pretty nice on the part of Windows Live Writer to expose that functionality.
When you select the image, you’ll see the “Kick It Counter” properties on the right, of which there are none:
That’s really all there is to the plugin, it’s pretty basic. It doesn’t (currently) allow you to change any of the colors, but that’s something you could manually update in the Wordpress plugin itself, if you want.
To install the plugin, download and run the MSI available on my garage sale code page listed under “DotNetKicks Windows Live Writer Plugin”.
Wordpress Plugin
The Wordpress plugin is beyond simple, partly thanks to the extensibility support the Wordpress developers have built in. The plugin adds a filter that modifies the post content before it gets displayed in the browser. Note that I don’t actually modify the stored post content itself – I want to be able to turn this off and have the “kick it” counters go away.
To install, download and unzip the dotnetkicks.php file from my garage sale code page (listed under “DotNetKicks Wordpress Plugin”). Just upload it to your wp-content\plugins subfolder, and activate it from your admin page:
After activating, you’ll see the “kick it” image on the appropriate posts.
If anybody wants to create plugins or whatever for other blogging platforms that will interpret this placeholder, post a comment here with a link to your implementation!
Finally
The moment we’ve all been waiting for – I’m going to make use of the barely useful tools I created! Feel free to kick this post.
November 1st, 2007 at 11:21 am
[...] DotNetKicks "Kick It" Counter Plugin for Windows Live Writer | Aaron Lerch [...]
November 27th, 2007 at 4:38 pm
[...] http://www.aaronlerch.com/blog/2007/10/21/dotnetkicks-kick-it-counter-plugin-for-windows-live-writer... [...]
November 27th, 2007 at 4:56 pm
Hey Aaron
Thanks a lot for the tool. Works perfectly. Would it be possible to do a similar tool for Digg Buttons? I’ve tried some other tools, but your approach seems the best one for Wordpress. Or can you release the Source Code?
November 27th, 2007 at 5:21 pm
I’ve released the source on my Tools page:
http://www.aaronlerch.com/blog/tools/
It’s released under the MIT License, which basically means “have at it”.
December 20th, 2007 at 9:07 am
[...] I found was a guy who’d figured a way to get the code snippet into live writer. But, you still have to insert the tag. However, he did have a plug-in that gave me [...]
February 10th, 2008 at 11:01 pm
[...] WordPress AND Windows Live Writer is your go-to editor AND your posts tend to be .NET related, give Aaron Lerch’s DotNetKicks “Kick It” Counter Plugin for Windows Live Writer a try. Again, it works like a charm. Well, if I am being completely honest, I [...]
April 30th, 2008 at 2:26 am
[...] I tried using the some of the Windows Liver Writer plugins that are available on CodePlex and other places, but none that I found did exactly what I wanted. So I decided to create a Windows Liver Writer [...]
April 30th, 2008 at 2:36 am
[...] I tried using the some of the Windows Liver Writer plugins that are available on CodePlex and other places, but none that I found did exactly what I wanted. So I decided to create a Windows Liver Writer [...]
May 10th, 2008 at 9:18 am
[...] But I decided to try to contribute, and I found a really interesting plugin for Windows Live Writer here. I’ve installed also the WordPress related plugin, so let’s see if all [...]
September 10th, 2008 at 10:31 pm
Guess i must be slow, but how do i get the button to show up in wordpress? I’ve installed the plugin, actived it, and now what?
I’ve tried inserted into the html and nothing happens.
September 11th, 2008 at 7:14 am
It works for me on the latest version of Wordpress – what version are you using?
September 15th, 2008 at 7:34 pm
My bad aaron. It does work from Live Writer. Somehow i thought the posts was a live writer or wordpress plugin instead of a live writer and wordpress plugin. I hate live writer (why can’t you paste code straight from visual studio and keep the formatting?) so i’ll have to keep looking for a solution.
September 15th, 2008 at 8:29 pm
Matt, just keep in mind that the wordpress plugin works regardless of authoring tool – as long as there’s a “” comment on the page, it’ll be replaced.
Good luck!
September 16th, 2008 at 8:07 pm
And I call myself a programmer! Yikes! I finally opened up the php file to see what it’s doing and found out my problem straight away. I was putting in
instead of
at the end of my posts. Works like a charm, thanks.
March 30th, 2009 at 4:26 am
Thanks for sharing, I’ll have a try.