Page 1 of 1

[SHORTCODE] Tiny URL

Posted: Thu Dec 10, 2015 10:32 am
by Fred
Hi,

This shortcode add short url with tinyurl API service.
In your shortcode plugin configuration, add this tip:

Code: Select all

	// Add Shortcode: {Tiny url='http://www.bludit.com'}
	Shortcode::add('Tiny', function ($attributes) {	
	    // Extract
	    extract($attributes);
	    $url = (isset($url)) ? file_get_contents('http://tinyurl.com/api-create.php?url='.$url) : '';
	    // return
	    return $url;
	});
Now in your posts/pages, add this shortcode :

Code: Select all

{Tiny url='http://www.bludit.com'}
Result:

Code: Select all

http://tinyurl.com/gs3zxbp