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.

472 Blablas

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

  1. 251
    Ozh France »
    thought, on 21/Aug/10 at 12:20 pm # :

    Aleksey » Why on Earth would you do this?? Just publish, and then you have the Shorturl button or the YOURLS metabox.

  2. 252
    Aleksey Russia »
    said, on 21/Aug/10 at 12:41 pm # :

    This way I have to uncheck auto-posting to twitter as the tweet sent right after publishing will contain generated URL like http://mydomain/URL/a1, instead of one based on keywords I need… Using your way, I'll need to publish the post (with wp's URL) then manage custom URL down in meta section, update the post and send the tweet manually from yourls' box on the right of the editing page.
    It would be perfect to have an opportunity to set custom URL in advance, so that the tweet with it be sent right when you hit 'publish' button.

    Maybe I'm missing something? Please excuse me then and give some hint on where's the truth's hiding :)

  3. 253
    Ozh France »
    commented, on 21/Aug/10 at 1:57 pm # :

    Aleksey » Indeed there's a much easier way. Wait 15 minutes till the new version of the plugin shows up in the repository, update your plugin, and publish a new post with a custom field named "yourls-keyword" in which you will put the custom keyword you'd like to use for your short URL. BTW, just added this without testing, so tell me if that works as expected :)

  4. 254
    Alexey Russia »
    wrote, on 21/Aug/10 at 5:29 pm # :

    Ozh >> Thanks for awesome support! Never have faced anything this fast…

    Just updated plugin, but unfortunately there's no such custom field you mentioned…

    http://twitpic.com/2guiyw – just a proofpic

  5. 255
    Ozh France »
    thought, on 21/Aug/10 at 5:43 pm # :

    Alexey » of course not, how could the plugin guess what keyword you want? Write a new post and *create* a custom field (button "Add custom field").

  6. 256
    Alexey Russia »
    commented, on 21/Aug/10 at 5:48 pm # :

    Hmm… But custom fields are to be from the dropbox and ther e's no such entry as "yourls-keyword" to assign the value I need. See the pic again pls. Oh, and sorry for being noob to wp =(

  7. 257
    Alexey Russia »
    thought, on 21/Aug/10 at 5:53 pm # :

    Oh, what a mess I just wrote. I just found out what you've ment. Sorry… Going to try it now.

  8. 258
    Alexey Russia »
    said, on 21/Aug/10 at 6:00 pm # :

    Finally, it does exactly what is needed. THANKS. You can put "The Best and The Fastest support of 2010 and ever" on top of this site! Great ;)

  9. 259
    Brad Zimmerman United States »
    commented, on 25/Aug/10 at 4:12 pm # :

    The custom keyword value is not working for me, anyone else having this issue?

    I have added the custom field yourls-keyword but it doesn't use it for anything. I have updated to the most recent version of the plugin.

  10. 260
    Alexey Russia »
    wrote, on 25/Aug/10 at 4:39 pm # :

    Brad, try it with the underscore like other key-words. I don't remember for sure but the plugin is 100% working

  11. 261
    Brad Zimmerman United States »
    wrote, on 25/Aug/10 at 4:56 pm # :

    Thanks,
    it did work using yourls_keyword, I would change you info above for others.

  12. 262
    Ozh France »
    said, on 25/Aug/10 at 5:27 pm # :

    Brad Zimmerman » Just pushed a plugin update that works with 'yourls_keyword' and 'yourls-keyword' to avoid confusion

  13. 263
    Jorgicio Chile »
    said, on 25/Aug/10 at 11:22 pm # :

    Hi. I've got the following problem when I try to connect my blog with Twitter.
    Here it is:

    Woah there!

    This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.

    And I don't know why it happens :/ And I don't use the consumer keys in another plugin.

    Thanks

  14. 264
    Ozh France »
    commented, on 26/Aug/10 at 8:52 am # :

    Jorgicio » Bad plugin configuration

  15. 265
    carolus Germany »
    thought, on 27/Aug/10 at 3:42 pm # :

    The plugin is very good working, but with the latest releases, I miss the re-twitter function for pages. How can I re-avtivate this?

    Thank you

  16. 266
    Jorgicio Chile »
    thought, on 29/Aug/10 at 5:31 pm # :

    Ozh:
    I don't think that may be a bad configuration… I put all my information correctly and I still have this error :/

  17. 267
    AGb United States »
    said, on 02/Sep/10 at 1:03 am # :

    Jorgicio: Press the "Reset Consumer Key/Secret" button for the application you created @ http://twitter.com/apps for a new set of numbers while logged into you Twitter account. Copy these to YOURLS plugin. This should fix your issue.

  18. 268
    AGb United States »
    commented, on 02/Sep/10 at 1:12 am # :

    Great job Ozh! Thanks! One slight problem we're having. The plugin is creating a short URL for blog posts that have previously been posted. It is not posting these to Twitter, just creating a short URL for these posts, some which were posted months ago. It would appear that these posts did not have a short URL previously, since their Original URLs are not duplicated in the database.
    Disabled all plugins except YOURLS and it still creates a URL for old posts, approaching 400 since we upgraded yesterday. There has to be a trigger to this, but I have not isolate what it is. Any thoughts?

  19. 269
    Ozh France »
    commented, on 02/Sep/10 at 7:11 am # :

    AGb » Normal behavior. Short URLs are created on the fly to be included in the <head> section, in place of the wp.me link

  20. 270
    Jorgicio Chile »
    commented, on 04/Sep/10 at 7:31 am # :

    AGb: I tried this and it still doesn't work. And I don't know why.
    Thanks.

  21. 271
    Jorgicio Chile »
    wrote, on 04/Sep/10 at 5:23 pm # :

    Hey, folks!
    I solved the problem!
    I had activated the plugin "Twitconnect", so I deactivated it, then I reactivate YOURLS WordPress to Twitter, configurated it and it works!
    Then I reactivate Twitconnect and all is going on!
    Thanks.

  22. 272
    Chris Edes United States »
    thought, on 08/Sep/10 at 8:10 am # :

    I installed this plugin and WordPress stopped working. The website looks OK, but when I log in, I see the panel on the left but that's it. The rest of the interface is just blank, nothingness. Not good.

  23. 273
    Chris Edes United States »
    wrote, on 08/Sep/10 at 8:14 am # :

    Ha ha! WordPress 3.0 or higher is required. If you have this problem, delete the plugin folder at /wp-content/plugins and all will be OK again.

  24. 274
    Ozh France »
    wrote, on 08/Sep/10 at 8:26 am # :

    Chris Edes » No. If you have this problem, UPGRADE.

  25. 275
    andrew United States »
    wrote, on 08/Sep/10 at 7:11 pm # :

    Hey guys -

    Just updated to the latest version of plugin thanks to Twitter changes. When I put in my keys and click the "sign in with twitter" button, it takes me to Twitter where I authorize the app. But then when I continue it takes me to the home page of my blog with the oauth token like this:

    http://myblogurl.com/?oauth_token=tokennumbersetc

    …and the Twitter connection isn't actually happening. Any ideas?

    Thanks!

  26. 276
    Brad United States »
    wrote, on 13/Sep/10 at 5:05 pm # :

    Having encounter the error most recently after upgrading WordPress 3.0 .. Just installed the update Yourls 1.4.4 .. and still getting error; any help?

    Please configure YOURLS – WordPress to Twitter settings now; YOURLS – WordPress to Twitter configuration incomplete.

    It has to do with my Twitter settings .. I have entered in correct Twitter Consumer Key & Twitter Consumer Secret .. but still not working ..

    Any suggestions?

    Thanks

  27. 277
    andrew United States »
    replied, on 13/Sep/10 at 5:10 pm # :

    One additional point on my problem…I host my URL shortener on a different domain than my blog. Does that matter when setting up the Twitter connection?

  28. 278
    Pat OBrien United States »
    replied, on 13/Sep/10 at 6:37 pm # :

    Is it possible to add the ability to schedule multiple tweets in an upcoming release of the plugin? This would allow me to schedule tweets using the twitter app integration.

  29. 279
    Ozh France »
    thought, on 13/Sep/10 at 8:35 pm # :

    Pat OBrien » I'd rather have the other way round: a tweet scheduler plugin into which my plugin could hook. I don't think I'll add such a feature to my plugin, it's just too far from the initial purpose

  30. 280
    Fabrizio Castagnotto Italy »
    said, on 17/Sep/10 at 11:11 am # :

    I upgraded from WP 2.9.x to WP 3.01, then I reinstalled the plugin and configured it again

    when I click on "sign in with twitter" I can succesfully log in on twitter website, AUTHORISE the app, but then I go back to my domain and get a "not enough permissions" error :-/

    the URL is similar to this:

    /wp-admin/admin.php?page=tweetable_install&installing=1&oauth=1&oauth_token=[...]

    any help?

  31. 281
    Fabrizio Castagnotto Italy »
    replied, on 17/Sep/10 at 11:13 am # :

    please ignore my previous post.. it is obvious that I used the wrong App i set up on Twitter.com (the one I created for tweetable plugin)

    sorry!

  32. 282
    Fabrizio Castagnotto Italy »
    replied, on 17/Sep/10 at 11:31 am # :

    Anyway I have the same problem as Andrew, in a previous unanswered message:

    andrew United States »
    commented, on 08/Sep/10 at 7:11 pm # :

    Hey guys -

    Just updated to the latest version of plugin thanks to Twitter changes. When I put in my keys and click the “sign in with twitter” button, it takes me to Twitter where I authorize the app. But then when I continue it takes me to the home page of my blog with the oauth token like this:

    http://myblogurl.com/?oauth_token=tokennumbersetc

    …and the Twitter connection isn’t actually happening. Any ideas?

    Thanks!

  33. 283
    Matt Mansfield United States »
    said, on 23/Sep/10 at 2:57 pm # :

    Hey there,

    Love this plugin except it is not creating the URL. Tried with all third party apps (have it set up now with bit.ly API) and it will tweet the post but not include the URL.

    My Tweet Message template was custom, but I tried with this default and it still does not work: Just posted: %T %U

    In the post screen YOURLs area, I get the message, "Bleh. The URL shortening service you configured could not be reached as of now. This might be a temporary problem, please try again later!"

    This has been going on for days.

    Thanks in advance for any suggestions you may have.

    -Matt

  34. 284
    Andrew United States »
    commented, on 24/Sep/10 at 3:22 am # :

    Don't mean to be a pest here, but I miss my automatic twitter posting. Here's my problem again. Any support, please?

    ::
    Just updated to the latest version of plugin thanks to Twitter changes. When I put in my keys and click the “sign in with twitter” button, it takes me to Twitter where I authorize the app. But then when I continue it takes me to the home page of my blog with the oauth token like this:

    http://myblogurl.com/?oauth_token=tokennumbersetc

    …and the Twitter connection isn’t actually happening. Any ideas?

  35. 285
    Ozh France »
    wrote, on 24/Sep/10 at 8:12 am # :

    Andrew » conflicting plugin… bad configuration… dunno.

  36. 286
    andrew United States »
    wrote, on 24/Sep/10 at 6:09 pm # :

    ozh – I'm using YOURLS 1.4. Do I need to update it to get it to work with the plugin?

  37. 287
    Ozh France »
    commented, on 24/Sep/10 at 6:13 pm # :

    andrew » Don't know. I don't test old versions. I'd say probably not, but no guarantee.

  38. 288
    Matthew Cupka United States »
    thought, on 24/Sep/10 at 11:03 pm # :

    Hi all,

    I seem to be experiencing the same problem as Andrew and Fabrizio. I'm using Version 1.4.4 but no matter what I do I can't complete the Twitter configuration. It redirects back to my blog when I click "Allow" but the Twitter settings always remain incomplete with a "Could not authenticate you" message above the "Sign in with Twitter" button. I've closed/reopened the browser, cleared cache and cookies, reset Twitter keys, reinstalled the plug-in, and nothing seems to work. What am I doing wrong here?

    Any help would be appreciated!

    Thanks!

    -Matt

  39. 289
    Ozh France »
    replied, on 25/Sep/10 at 12:00 am # :

    Matthew Cupka » deactivate the other plugins that have to do with Twitter.

  40. 290
    Matt Mansfield United States »
    said, on 25/Sep/10 at 12:09 am # :

    Oh well – deactivated and deleted all plugins and even changed theme to get away from the one that had twitter built in and the URL is still not shortened. The post to twitter works, but no URL…bummer.

    "Hey there,

    Love this plugin except it is not creating the URL. Tried with all third party apps (have it set up now with bit.ly API) and it will tweet the post but not include the URL.

    My Tweet Message template was custom, but I tried with this default and it still does not work: Just posted: %T %U

    In the post screen YOURLs area, I get the message, “Bleh. The URL shortening service you configured could not be reached as of now. This might be a temporary problem, please try again later!”

    This has been going on for days.

    Thanks in advance for any suggestions you may have.

    -Matt"

  41. 291
    andrew United States »
    said, on 25/Sep/10 at 12:21 am # :

    I completely deleted all my other plugins related to Twitter.

    If I host my YOURLS on a different domain name, should the domain I provide to Twitter for the app be my blog our that of the YOURLS instance?

  42. 292
    Ozh France »
    thought, on 25/Sep/10 at 10:32 am # :

    Matt Mansfield » then it looks like you simply misconfigured the plugin and it cannot contact the shortener… Try setting it on same server and on remote.

  43. 293
    Dave Bonds United States »
    said, on 25/Sep/10 at 6:41 pm # :

    What could be the problem here?

    After registering with Twitter and inserting the proper keys, the 'Sign in with Twitter' button appears. After clicking 'Sign in..' it fails with this error:

    Fatal error: Cannot redeclare class OAuthException in /home/dbdotcom/public_html/wp-content/plugins/yourls-wordpress-to-twitter/inc/oauth_lib/OAuth.php on line 8

    Any ideas?

  44. 294
    Ozh France »
    said, on 25/Sep/10 at 11:59 pm # :

    Dave Bonds » I think I'm going to make a plugin that will respond this to every single comments on this page: "conflicting plugin".

  45. 295
    andrew United States »
    thought, on 26/Sep/10 at 12:39 am # :

    Ozh – so if I turned off every other plugin then you think yours would start working again?

  46. 296
    Dave Bonds United States »
    wrote, on 26/Sep/10 at 12:48 am # :

    Thanks Ozh. I've only got 9 other active plugins, none of which use OAuth, so I'm not sure what would be conflicting.

    Turns out I just commented out lines 6-8:

    1. class OAuthException extends Exception {
    2. //pass
    3. }

    in OAuth.php and it's working fine.

    Not really sure if those lines are necessary?

    Awesome plugin though! Thanks!

  47. 297
    Robert Mann United States »
    wrote, on 04/Oct/10 at 4:49 pm # :

    Greetings. On September 1 the WordPress auto-posting function to Twitter stopped working. The YOURLs URLs are still forming properly and I can copy and paste to Twitter, but the edit post fields stopped working, even though they give a success message. Many thanks.

  48. 298
    Ozh France »
    thought, on 04/Oct/10 at 9:18 pm # :

    Robert Mann » version of the plugin?

  49. 299
    Robert Mann United States »
    said, on 04/Oct/10 at 9:32 pm # :

    Version is 1.3.3. Thanks

  50. 300
    Ozh France »
    replied, on 04/Oct/10 at 9:48 pm # :

    Robert Mann » Thought so. How about you update?

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.