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. 101
    Andrew Merskin United States »
    thought, on 19/Oct/09 at 4:24 pm # :

    Rose, same here. I set it all up correctly without any luck at all. I'm getting the "Bleh…" errors.

  2. 102
    Oliver Austria »
    said, on 24/Nov/09 at 6:43 pm # :

    hi,
    thx for this awesome plugin. works great, but for every new post, it creates 2 short urls with the same target url. any idea?
    oliver

  3. 103
    Ozh France »
    replied, on 24/Nov/09 at 9:40 pm # :

    Oliver » Never heard of that. How are the posts published? Via the regular interface? Via XMLRPC? Scheduled or instant? Give more details and file an issue there please.

  4. 104
    Martin Sweden »
    said, on 03/Dec/09 at 10:03 am # :

    Great plugin and I really like the YOURLS functionality.

    It would be great if the WP plugin would support creating short links when adding links with the edit post/page views.

    Or, perhaps even auto-generation of short links of all (or selected) links in a post, but that I suppose would require quite a lot more development.

  5. 105
    Ozh France »
    wrote, on 03/Dec/09 at 10:38 am # :

    Martin » There is sort of auto generation. Simply add the template tag to display a short URL in your single.php and if the short URL has not been generated already, it will be on the fly at display time

  6. 106
    Martin Sweden »
    said, on 03/Dec/09 at 12:43 pm # :

    I understand this works to create a short link to the current post. But, I would like to "replace" (external) links in the post with short links. Is that also possible using a template tag? If so, what template tag? I couldn't find it.
    Thanks!

  7. 107
    Ozh France »
    commented, on 04/Dec/09 at 9:06 am # :

    Martin » Not possible at the moment

  8. 108
    Scott United Kingdom »
    said, on 07/Dec/09 at 2:57 pm # :

    Just wondering if there's going to be an option to add the category to the auto-generated message on Twitter? At present we can just get the url and title.

  9. 109
    Ozh France »
    thought, on 07/Dec/09 at 7:45 pm # :

    Scott » This is planned in the next version of the plugin, which will be released errr I don't know when :)

  10. 110
    Aryan Mughal Pakistan »
    replied, on 08/Dec/09 at 9:38 pm # :

    Hi,

    Is There Any Possibility That we configure multiple twitter accounts so that the post goes to all the twitter accounts

    Thanks In Advance

  11. 111
    Ozh France »
    replied, on 08/Dec/09 at 10:03 pm # :

    Aryan Mughal » Twitter spam? Not going to implement something like this :)

  12. 112
    Aryan Mughal Pakistan »
    replied, on 08/Dec/09 at 10:44 pm # :

    Hi,

    I dun want this feature for spamming… i work with my friend on a website who wants to update all the twitter accounts will latest news

  13. 113
    Scott United Kingdom »
    replied, on 11/Dec/09 at 1:37 am # :

    Cheers for the reply Ozh! Looking forward to the next version! Keep up the good work :-)

  14. 114
    Sujit Philipose India »
    replied, on 11/Dec/09 at 9:45 pm # :

    Hi there OZH!!!
    Long back i had given a request for adding up ping.fm into this plugin.

    I remember u informing me that you are working upon it and that ping.fm hasn't authorized the app from their side yet.

    Any updates on that??? :)

  15. 115
    Ozh France »
    commented, on 13/Dec/09 at 12:28 am # :

    Sujit Philipose » No. I just dropped the whole idea of doing anything with ping.fm for the rest of my life. Sorry :)

  16. 116
    Sujit Philipose India »
    wrote, on 14/Dec/09 at 8:22 pm # :

    OZH >> its ok… ;)
    anyways, i luv YOURLS and your plugin. Would find some alternative way to post yourls link to ping.

    Cheers :)
    Sujit

  17. 117
    Dan United States »
    replied, on 19/Dec/09 at 6:12 pm # :

    Any chance we will be able to enter custom URLs instead of random with this plugin?

  18. 118
    Ozh France »
    said, on 19/Dec/09 at 8:12 pm # :

    Dan » I don't understand what you mean. You don't "enter URLs" in this plugin

  19. 119
    Dan United States »
    said, on 19/Dec/09 at 8:15 pm # :

    Sorry, I meant like in this image: http://yourls.org/images/admin-dashboard.gif

    Where you can enter custom short tags instead of randomly generated ones.

  20. 120
    Ozh France »
    replied, on 19/Dec/09 at 8:18 pm # :

    Dan » Ho. Not sure how this would be feasible, from a user POV. How do you envision the UI of such a feature?

  21. 121
    Dan United States »
    commented, on 19/Dec/09 at 8:22 pm # :

    I was thinking down in the box on the right of the add/edit post/page section.

    http://www.d4nz.net/images/yourls.jpg

    You could have an input box to enter the custom short tag, if left blank it would be random?

  22. 122
    Andy United States »
    thought, on 23/Dec/09 at 8:06 am # :

    Curious if anyone else was having difficulty with this plugin after upgrading to WordPress 2.9?

    It automatically tweets everything but the YOURL shortened URL. When I go to the YOURLs admin panel, no shortened URL was ever made and I have to create one and post it manually. I then delete the initial botched tweet.

    The only other change I made was to remove the "Shortlink" plugin by Sam Johnston and Rob Allen. I tried to reinstall it, but received a fatal error.

    Any feedback from others would be helpful.

  23. 123
    Ozh France »
    wrote, on 24/Dec/09 at 9:54 pm # :

    Andy » Nothing in 2.9 has affected how the YOURLS plugin works, except maybe if using the official WP Stats plugin, which has been fixed in latest YOURLS released yesterday

  24. 124
    Rocky United States »
    commented, on 30/Dec/09 at 11:11 am # :

    I have just set up my yourls account and got it working great. I used the value applications part to my hosting company RnRGodomains and they instaled it for me. Works great and didn't have to do a thing but input login info and database login info. But I too am not able to get it to send the shorten URL. It is set up right but on my twitter account it will not post the short link. It post the message in twitter and it also puts the shortened URL in my admin page of my YOURLS. But in twitter no link for anyone to link back to my wordpress blog post from twitter. Post is in twitter though. Please help. Everything works great otherwise.

  25. 125
    Rob Parker United Kingdom »
    wrote, on 06/Jan/10 at 3:09 pm # :

    Hi, I was wondering if it would be OK by you to create an 'own-branded' version of this plugin for my own Yourls installation? I would, of course, still maintain links back to your site.
    Thanks!

  26. 126
    Ozh France »
    wrote, on 07/Jan/10 at 11:54 am # :

    Rob Parker » Sure. Please just don't distribute it as if you were the author :)

  27. 127
    Mel Reyes United States »
    thought, on 13/Jan/10 at 6:19 pm # :

    Andy, I'm having the same problem, the link is created, show up in custom, doesn't show up in the edit sidebox and doesn't post with the shortened link. I'm using a public api instance on api.mrte.ch

  28. 128
    Andy United States »
    thought, on 13/Jan/10 at 6:46 pm # :

    Apologies to Ozh, but Mel, I couldn't get the plugin to work, even after fresh installing a new, updated copy. I ended up switching over to the plugin Shorten2Ping and it is working just fine.

    Ozh, I am using the WP Stats plugin and as I mentioned, it still wasn't working even after uninstalling the plugin and reinstalling. I may give it another try if a new version comes along in the future.

  29. 129
    Steve O (gswd) United States »
    replied, on 18/Jan/10 at 8:12 pm # :

    I am running version 1.3.3 of the plugin. I am running WordPress 2.9.1 and I have the WordPress Stats plugin (ver 1.6.1). Today's blog post said that it tweeted, but it did not. I used the re-promote and it did show in my twitter feed.

    I found that a bit odd, so figured I would checkin here to see if anyone had been having similar. And I see that it is supposed to be working fine with 2.9 and WordPress Stats. So I am confused as to what could be the issue.

  30. 130
    Garret United States »
    commented, on 24/Jan/10 at 6:59 pm # :

    I was wondering if you guys have thought of making yoursl truly multi user. Meaning users can sign up for an account, have their own login and can only see their stats? Or is it there and I'm just totally missing it?

  31. 131
    Ozh France »
    commented, on 25/Jan/10 at 6:38 am # :

    Garret » A future version of YOURLS will be multi user, probably

  32. 132
    Garret United States »
    wrote, on 04/Feb/10 at 12:52 am # :

    Ozh,

    Was wondering if you were open to getting paid for pushing forward some additions to Yourls.

    Looking for true multi user with email verification on sign-up.

    Extending stats as an aggregate per user would be nice too, enabling true reporting on stats.

    Thanks
    Garret

  33. 133
    Ozh France »
    replied, on 04/Feb/10 at 6:38 am # :

    Garret » multi user is planned as a future feature of YOURLS, so I'd feel a bit dishonest to charge anyone to code it. Although there's no ETA for it.

  34. 134
    Martyn United Kingdom »
    replied, on 06/Feb/10 at 2:32 pm # :

    I know 100% that this is a user (me) issue! But driving this newbie crazy so just after some help!
    I've installed YOURLS in my public_html dir in sub dir /s
    I've changed config.php (& included the /s) & tried a variety of paths in the plugin settings.
    The YOULRS function works if I navigate straight to the page & type in a url manually, but within wordpress once I post a new entry, this doesn't create a url in the YOURLS page.
    I don't even see the screenshot as above in the write page (to re-create short urls)

    Gotta be missing something :)
    Thanks in advance
    Martyn

  35. 135
    Eric United States »
    wrote, on 11/Feb/10 at 7:22 am # :

    Hello Ozh,

    Love YOURLS, thanks!

    I'm having some trouble with the WordPress plugin. It will generate a shorturl just fine, but the tweets never seem to make it to Twitter. Any ideas? Was there something I missed that I needd to install?

    Thanks,
    Eric

  36. 136
    Eric United States »
    commented, on 13/Feb/10 at 7:47 am # :

    Hmm… Perhaps Twitter blacklisted my site, as I can't even get my tweets in my WordPress sidebar…

    Grr!

    Still, YOURLS is great! Thanks again, Ozh!

    Eric

  37. 137
    Udegbunam Chukwudi Nigeria »
    said, on 23/Feb/10 at 10:35 pm # :

    Works fine on my blog but then I'm worried cos it seems to be creating short urls for posts I didn't specify. Why is this happening?

    BTW what is the function of the Short URL auto-discovery in the options page?

    Thanks a million

  38. 138
    Ozh France »
    said, on 24/Feb/10 at 12:32 am # :

    Udegbunam Chukwudi » It's creating short URL for all posts on the fly if you use the template tag, that's the intended behavior

  39. 139
    Udegbunam Chukwudi Europe »
    wrote, on 24/Feb/10 at 12:38 am # :

    Well the strangest thing is that I'm not using the template tags and still it's as though it's crrating links for every visited page.

  40. 140
    Ozh France »
    said, on 24/Feb/10 at 12:43 am # :

    Udegbunam Chukwudi » then you probably enabled the autodiscovery short url stuff that inserts the short link in the head of every post

  41. 141
    Udegbunam Chukwudi Europe »
    commented, on 24/Feb/10 at 6:18 am # :

    LOL. Thanks a million. That was actually the problem. I've deactivated it and the links are no longer showing up.

    Thanks man.

  42. 142
    michael United States »
    commented, on 02/Mar/10 at 8:29 pm # :

    I set up my own remote YOURLS install, but I can't seem to get my site to shorten a URL with it. I keep getting the "Bleh. Could not generate short URL." Error. Any ideas?

  43. 143
    Ozh France »
    commented, on 02/Mar/10 at 8:34 pm # :

    michael » your blog cannot access your YOURLS setup. Wrong login/password, or web hosts cannot connect to each other (firewall etc)

  44. 144
    michael United States »
    replied, on 02/Mar/10 at 10:26 pm # :

    Just to double check, I just switched the plugin to using is.gd instead of my own service and received the same error. Is there some specific setting on the server I need to set?

  45. 145
    Ozh France »
    commented, on 02/Mar/10 at 10:33 pm # :

    michael » The plugin uses the internal WP API to make HTTP requests. If you can, say, auto update WP or plugins, it should just work.

  46. 146
    michael United States »
    said, on 02/Mar/10 at 10:44 pm # :

    Ah-ha, I have a lot of problems auto-updating WordPress, so I'll start my investigations there. Thank you very much.

  47. 147
    Mark Brazil »
    thought, on 10/Mar/10 at 6:17 pm # :

    Ozh,

    I think there is something wrong with the plugin.
    It's creating the short url OK. But it can not post to twitter.

    Just to verify if my Server IP was blocked, I installed the plugin at my personal computer. It created the short url, but did not post to twitter.

    Maybe twitter changed something. Could help us?
    Thanks.

  48. 148
    Aryan Pakistan »
    wrote, on 11/Mar/10 at 2:51 pm # :

    how to connect this plugin with my yourls self hosted installation though api not username and password …. and also want to say that the new version 1.4.2 is giving access anybody to admin without using username and password…

  49. 149
    Ozh France »
    said, on 11/Mar/10 at 3:54 pm # :

    Aryan » 1.4.2 precisely fixes the blank login issue that was in previous versions. Not sure what you mean with "though api not username and password". The plugin does use the API, and you need a login/pwd to connect to it.

  50. 150
    Aryan Pakistan »
    said, on 11/Mar/10 at 8:53 pm # :

    Thats what i mean …. let that if my user want to use shorten url of my domain like wlink.in than how can it paste the username and password in the yourls wordpress plugin

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.