Lessn Shortlinks WordPress Plugin

I recent­ly pur­chased the somad.es domain for use with my own URL short­en­er. (Van­i­ty or own­ing my own URLs: you decide.) I decid­ed to use Alan Hogan’s Lessn More, an improved fork of Shaun Inman’s Lessn. I then decid­ed I want­ed to inte­grate the short­link into my Word­Press install, but the exist­ing WP Lessn plu­g­in isn’t very good. Its admin page does­n’t adhere to WP secu­ri­ty best prac­tices, it does­n’t use WP’s HTTP API, and it does­n’t prop­er­ly inte­grate with WP 3.0’s short­link API. In short, it does­n’t do things the WP way.

So, I made my own lit­tle plu­g­in. I did­n’t want anoth­er plu­g­in set­tings page, so you have to hard­code your Lessn URL and API key. It inte­grates with the “Get Short­link” but­ton on your write/edit post screen, and the rel­e­vant short­link HTTP head­er and meta ele­ments are auto-insert­ed. Only the “post” post_type will get Less­n’d by default, but see the bot­tom of the plu­g­in for how to add addi­tion­al post_types.

Now, I just need to fig­ure out how to inte­grate short­links for humans rather than just machines.

2 Comments

  1. Alex
    Posted July 6, 2011 at 6:17 pm | Permalink

    Hi Matt,

    I’m try­ing to get your plu­g­in to work with my site, and when­ev­er I click the Get Short­link but­ton, the con­tent of the short­link is my 404 page.

    I added the API key and the API base.

    My lessn is installed at http://example.com/u/ and the back­end of it is at http://example.com/u/-/ … so my API base is:
    con­st LESSN_API_BASE = ‘http://example.com/u/-/’; // the API base for your Lessn install

    Am I miss­ing something? 

    Thanks so much!!

  2. Matt
    Posted July 6, 2011 at 11:44 pm | Permalink

    That seems like it should work. Have you got­ten a link to short­en prop­er­ly via the API call otherwise?

2 Trackbacks

  1. By Uptonian Thoughts on Twitter — Uptonian Thoughts on January 4, 2012 at 11:20 pm
  2. By umwbl.gs and DIY url shorteners | Tim Owens on January 29, 2013 at 8:42 am