{"id":1272,"date":"2009-06-25T22:15:12","date_gmt":"2009-06-25T20:15:12","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?page_id=1272"},"modified":"2014-08-21T14:44:33","modified_gmt":"2014-08-21T12:44:33","slug":"yourls-wordpress-to-twitter-a-short-url-plugin","status":"publish","type":"page","link":"https:\/\/planetozh.com\/blog\/my-projects\/yourls-wordpress-to-twitter-a-short-url-plugin\/","title":{"rendered":"YOURLS WordPress (a Short URL Plugin)"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2009\/06\/yourls-logo.png\" alt=\"yourls-logo\" title=\"yourls-logo\" width=\"201\" height=\"90\" class=\"alignright size-full wp-image-1276\" \/><a href=\"http:\/\/yourls.org\/\">YOURLS<\/a> (<strong>Y<\/strong>our <strong>O<\/strong>wn <strong>URL<\/strong> <strong>S<\/strong>hortener) is a URL shortener, like TinyURL, except it&#39;s all GPL and you can run it on your own server, publicly or for your own use only. It was made by <a href=\"http:\/\/lesterchan.net\/\">Lester Chan<\/a> and myself. Learn more about <a href=\"http:\/\/yourls.org\/\">YOURLS<\/a>.<\/p>\n<p>This plugin, <strong>YOURLS: WordPress to Twitter<\/strong>, is the bridge between YOURLS and your blog: when you publish a post or a page, it will use <strong>your own YOURLS install<\/strong>, either hosted on the same webserver, or another server, to create a short URL for your post.<\/p>\n<div class=\"message\"><strong>The latest version of the plugin does not support Twitter any longer<\/strong>. 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 href=\"https:\/\/www.google.com\/search?q=auto+tweet+wordpress+post\">a plugin for that<\/a>.\n<\/div>\n<div class=\"message\"><strong>This plugin is not maintained any longer<\/strong>. It&#39;s still working probably fine (here on this blog for instance) but I&#39;m not investing any more time on it. No support or anything.\n<\/div>\n<h2>Download<\/h2>\n<div class=\"download\">\nDownload the plugin : <a href=\"http:\/\/downloads.wordpress.org\/plugin\/yourls-wordpress-to-twitter.zip\">yourls-wordpress-to-twitter.zip<\/a><br \/>\nExtract and upload to your blog, preserving directory structure.<br \/>\nEnjoy.<\/div>\n<p><strong>Note<\/strong>: the plugin requires PHP 5 to run.<\/p>\n<h2>Template Tags for you theme<\/h2>\n<p>The plugin comes with two <a href=\"http:\/\/codex.wordpress.org\/Template_Tags\">template tags<\/a>:<\/p>\n<p><b><tt>wp_ozh_yourls_url()<\/tt><\/b><br \/>\nWill echo a HTML link with short URL (will generate it on the fly if needed) for the current post.<br \/>\nExample output:<br \/>\n<tt>&lt;a href=\"http:\/\/ozh.in\/j5\" rel=\"nofollow alternate shorter\" title=\"short URL\">http:\/\/ozh.in\/j5&lt;\/a><\/tt><br \/>\nSuggested use: in the loop, in single.php, in page.php<\/p>\n<p><b><tt>wp_ozh_yourls_head_linkrel()<\/tt><\/b><br \/>\nWill output a &lt;link\/> in &lt;head> for the current post (see <a href=\"http:\/\/revcanonical.appspot.com\/\">revcanonical.appspot.com<\/a> and <a href=\"http:\/\/shorturl.appjet.net\/\">shorturl.appjet.net<\/a> for more info)<br \/>\nExample output:<br \/>\n<tt>&lt;link rel=\"alternate short shorter shorturl\" href=\"http:\/\/ozh.in\/j5\" \/>\\n<\/tt><br \/>\nNote that WordPress echoes this &lt;link> out of the box so you mostly won&#39;t need this one.<\/p>\n<p>You can also use two other functions in your code and plugins:<\/p>\n<p><b><tt>wp_ozh_yourls_raw_url()<\/tt><\/b><br \/>\nWill return (or echo if you pass <tt>true<\/tt> to it) the short URL, with no HTML tag or anything else. Just the raw URL.<\/p>\n<p><b><tt>wp_ozh_yourls_geturl( $id )<\/tt><\/b><br \/>\nWill return (and generate on the fly if necessary) the short URL for post with id $id<\/p>\n<h2>Easy custom keyword<\/h2>\n<p>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: &quot;Add Custom Field&quot;) with name &quot;<tt><b>yourls-keyword<\/b><\/tt>&quot; and your custom keyword as a value.<\/p>\n<h2>Filters all over the place<\/h2>\n<p>If you&#39;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&#39;d like another filter somewhere else, please tell me!)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>YOURLS (Your Own URL Shortener) is a URL shortener, like TinyURL, except it&#39;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":241,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1272","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/1272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=1272"}],"version-history":[{"count":7,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/1272\/revisions"}],"predecessor-version":[{"id":3289,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/1272\/revisions\/3289"}],"up":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/241"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=1272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}