On: 2009/06/25 Viewed: 58359 times
Shorter URL for this page: http://ozh.in/m7

yourls-logoYOURLS (Your Own URL Shortener) is a URL shortener, like TinyURL, except it's all GPL and you can run it on your own server, publicly or for your own use only. It was made by Lester Chan and myself. Learn more about YOURLS.

This plugin, YOURLS: WordPress to Twitter, is the bridge between YOURLS and your blog: when you publish a post or a page, it will use your own YOURLS install, either hosted on the same webserver, or another server, to create a short URL for your post.

The latest version of the plugin does not support Twitter any longer. I have not enough free time to maintain that part, due to the regular changes from Twitter on their authentication process. If you want to auto tweet your posts, use a plugin for that.

Download

Download the plugin : yourls-wordpress-to-twitter.zip
Extract and upload to your blog, preserving directory structure.
Enjoy.

Note: the plugin requires PHP 5 to run.

Template Tags for you theme

The plugin comes with two template tags:

wp_ozh_yourls_url()
Will echo a HTML link with short URL (will generate it on the fly if needed) for the current post.
Example output:
<a href="http://ozh.in/j5" rel="nofollow alternate shorter" title="short URL">http://ozh.in/j5</a>
Suggested use: in the loop, in single.php, in page.php

wp_ozh_yourls_head_linkrel()
Will output a <link/> in <head> for the current post (see revcanonical.appspot.com and shorturl.appjet.net for more info)
Example output:
<link rel="alternate short shorter shorturl" href="http://ozh.in/j5" />\n
Note that WordPress echoes this <link> out of the box so you mostly won't need this one.

You can also use two other functions in your code and plugins:

wp_ozh_yourls_raw_url()
Will return (or echo if you pass true to it) the short URL, with no HTML tag or anything else. Just the raw URL.

wp_ozh_yourls_geturl( $id )
Will return (and generate on the fly if necessary) the short URL for post with id $id

Easy custom keyword

If you want your post to have a custom short URL instead of the random/sequential generated one, when you write a new post add a new custom field to it (button: "Add Custom Field") with name "yourls-keyword" and your custom keyword as a value.

Filters all over the place

If you're a coder and want to interact with the plugin, there are a lot of filters for you to do so. Just read the source and look for what you need (and if you cannot find what you need because you'd like another filter somewhere else, please tell me!)

Shorter URL

Want to share or tweet this page? Please use this short URL: http://ozh.in/m7

Metastuff

This page "YOURLS WordPress (a Short URL Plugin)" was posted on 25/06/2009 at 10:15 pm
Watch this discussion : Comments RSS 2.0.

467 Blablas

    Pages: « 1 2 3 4 5 6 7 8 9 [10] Show All

  1. 451
    Mike R United Kingdom »
    said, on 23/Oct/12 at 12:37 pm # :

    Hello,

    I've been using the plugin on a couple of sites and now it is starting to fail, I assume that this is down to the Twitter API changes?

    My personal site slows to a halt when the plugin is activated now :(

    Any updates or tweaks I can make?

  2. 452
    Peter R Austria »
    said, on 26/Oct/12 at 10:39 am # :

    I have the same issue with the oauth.
    only
    Logged on Twitter as @ ( followers)
    is displayed…

    When will there be a solution?

  3. 453
    Pisosse Denmark »
    wrote, on 13/Nov/12 at 2:55 pm # :

    I have lost the twitter write field alltogether..

    :-(

  4. 454
    aldy Indonesia »
    replied, on 26/Nov/12 at 4:14 pm # :

    Is this been updated? cos i cannot see 'yourls-api.php' file. and the Plugins name has changed, so the file directory were not the same as your guide.

    What should i choose if i installed the plugins in http://www.angelsempire.net//public_html/wp-content/plugins ? Local or Remote server?

    Please advice,

    Many thanks

  5. 455
    Ozh »
    commented, on 27/Nov/12 at 3:07 pm # :

    aldy » You didn't understand what the plugin is for. You won't find any yourls-api.php in that plugin.

  6. 456
    hobscotch Germany »
    replied, on 09/Dec/12 at 7:47 am # :

    Hi Ozh,

    I have the same problem like the other people. Failure:
    Could not authenticate with OAuth.

    How can we fix this problem?

    Best Regarts
    Sven

  7. 457
    Eitan Israel »
    thought, on 12/Dec/12 at 5:18 pm # :

    Hi,

    Updated to wordpress 3.5 and YOURLS 1.5.5
    When submitting all details, pressing save changes goes to my local YOURLS install.php and does not save twitter settings.

    Help?

    Cheers!

  8. 458
    Igor Brazil »
    thought, on 14/Dec/12 at 3:17 pm # :

    Hi!

    Yourls is not working on WordPress 3.5.

    Please, help us! :)

  9. 459
    Ozh »
    thought, on 16/Dec/12 at 11:23 pm # :

    Plugin updated: all Twitter related functions removed. Read the plugin page for more.

  10. 460
    Makis Greece »
    replied, on 16/Dec/12 at 11:32 pm # :

    Last plugin update broke WP backend

  11. 461
    Ozh »
    commented, on 16/Dec/12 at 11:44 pm # :

    Makis » Doh, much apologies to that, I had uploaded an incomplete file. This is fixed, I've just committed 1.6.1

  12. 462
    Makis Greece »
    commented, on 17/Dec/12 at 12:00 am # :

    No need to apology :)
    It was a good opportunity for me to thank you about your short url development and this plugin all together.

  13. 463
    Bob Decker United States »
    thought, on 17/Dec/12 at 6:12 pm # :

    I updated to the latest version of the YOURLS WP plugin yesterday, but it's redirecting me to install.php when I try to publish a new post on WP 3.5 and doesn't shorten the link. Is this a known bug? Is there anything I can do?

    Thanks so much for providing Twitter support in the past. We've surely been spoiled with it. It's another sign that the Twitter API guidelines will only hurt the company.

  14. 464
    Igor Brazil »
    wrote, on 17/Dec/12 at 6:54 pm # :

    I have exactly the same problem that Bob Decker has just mention it.

  15. 465
    Ozh »
    replied, on 17/Dec/12 at 10:11 pm # :

    Bob Decker & Igor » I cannot reproduce this, using "Remote" or "Local" works fine for me. What version of YOURLS are you using? Did you try resetting all settings and configure the WP plugin again?

  16. 466
    Bob Decker United States »
    said, on 17/Dec/12 at 10:20 pm # :

    I am on YOURLS 1.5. What settings should I try resetting? This didn't start occurring until I upgraded to WP 3.5.

  17. 467
    Igor Brazil »
    commented, on 17/Dec/12 at 10:59 pm # :

    @Ozh @Bob Derek

    I have reseted my plugin setting and now Yourls 1.6.1 is working fine.

    Thanks! :)

Pages: « 1 2 3 4 5 6 7 8 9 [10] Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.