Using API to generate short link

I want to use a shortcode that generates a short URL from API of Premium URL Shortener script. I added code from API to my template functions: // Main Function function shorten_url($url){ $siteurl=”http://go.mysite.com”; // FOR Example http://gempixel.com/short $apikey=”8jkyA3e7xs1J”; // You can get it from the user account if($apikey && $siteurl){ $short=@file_get_contents(“$siteurl/api?api=$apikey&url=”.strip_tags(trim($url))); $short=json_decode($short,TRUE); if(!$short[“error”]){ return $short[“short”]; … Read more

Problem duplicated shortlinks bitly

I’ve this plugin to create shortlink using the bitly API, but there’s a problem! function yoast_bitly_shortlink($url, $id, $context, $allow_slugs) { if ( ( is_singular() && !is_preview() ) || $context == ‘post’ ) { $short = get_post_meta($id, ‘_yoast_bitlylink’, true); if ( !$short || $short == ” ) { if ( !defined(‘BITLY_USERNAME’) || !defined(‘BITLY_APIKEY’) ) { $short=”http://yoast.com/wordpress/bitly-shortlinks/configure-bitly/”; … Read more

Short links in wordpress not working properly

Short links generated by wordpress is not working for post permalinks like this: https: //www.mysite.com/test/mypage It’s working if the permalink looks like this: https: //www.mysite.com/mypage In both cases I get a short url like this: https: //www.mysite.com/?p=123 Or https: //www.mysite.com/3BmdT (If I use a plugin: Shortn.it) 1 Answer 1 Shortlinks are not natively supported by … Read more

Shortlink directly to a media file?

We have a nice short domain name, but links to media files are way too long because the file names are long and you have the extended path for WordPress media. Like so: http://example.com/wp-content/uploads/my-long-filename.pdf You can link to the file like this: http://example.com/?p=1234 This is nice and short (in fact this is the perfect short … Read more